public class LuceneIndexService extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ANONYMOUS |
static String |
DEFAULT_ANALYZER |
static String |
DEFAULT_INDEX_DIRECTORY |
static int |
EVENTLOG_ENTRY_FLUSH_COUNT |
| Constructor and Description |
|---|
LuceneIndexService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addItemValues(org.apache.lucene.document.Document doc,
ItemCollection workitem,
String _itemName,
boolean analyzeValue,
boolean store)
adds a field value into a Lucene document.
|
protected org.apache.lucene.document.Document |
createDocument(ItemCollection aworkitem)
This method creates a lucene document based on a ItemCollection.
|
protected org.apache.lucene.index.IndexWriter |
createIndexWriter()
This method creates a new instance of a lucene IndexWriter.
|
boolean |
flushEventLog(int junkSize)
Flush the EventLog cache.
|
protected boolean |
flushEventLogByCount(int count)
This method flushes a given count of eventLogEntries.
|
String |
getLuceneAnalyzerClass() |
String |
getLuceneIndexDir() |
void |
indexDocuments(Collection<ItemCollection> documents)
This method adds a collection of documents to the Lucene index.
|
void |
rebuildIndex(org.apache.lucene.store.Directory indexDir)
This method forces an update of the full text index.
|
void |
setLuceneAnalyzerClass(String luceneAnalyzerClass) |
void |
setLuceneIndexDir(String luceneIndexDir) |
public static final int EVENTLOG_ENTRY_FLUSH_COUNT
public static final String ANONYMOUS
public static final String DEFAULT_ANALYZER
public static final String DEFAULT_INDEX_DIRECTORY
public String getLuceneIndexDir()
public void setLuceneIndexDir(String luceneIndexDir)
public String getLuceneAnalyzerClass()
public void setLuceneAnalyzerClass(String luceneAnalyzerClass)
public boolean flushEventLog(int junkSize)
The method flushes the cache in smaller blocks of the given junkSize. to avoid a heap size problem. The default flush size is 16. The eventLog cache is tracked by the flag 'dirtyIndex'.
issue #439 - The method returns false if the event log contains more entries as defined by the given JunkSize. In this case the caller should recall the method which runs always in a new transaction. The goal of this mechanism is to reduce the event log even in cases the outer transaction breaks.
LuceneSearchServicepublic void rebuildIndex(org.apache.lucene.store.Directory indexDir)
throws IOException
IOExceptionpublic void indexDocuments(Collection<ItemCollection> documents)
This method is used by the JobHandlerRebuildIndex only.
documents - of ItemCollections to be indexedIndexExceptionprotected boolean flushEventLogByCount(int count)
count - the max size of a eventLog engries to remove.protected org.apache.lucene.document.Document createDocument(ItemCollection aworkitem)
aworkitem - protected void addItemValues(org.apache.lucene.document.Document doc,
ItemCollection workitem,
String _itemName,
boolean analyzeValue,
boolean store)
doc - an existing lucene documentworkitem - the workitem containg the valuesitemName - the Fieldname inside the workitemanalyzeValue - indicates if the value should be parsed by the analyzerstore - indicates if the value will become part of the Lucene documentprotected org.apache.lucene.index.IndexWriter createIndexWriter()
throws IOException
IOExceptionCopyright © 2006–2019 Imixs Software Solutions GmbH. All rights reserved.