|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
org.ceryle.util.search.Indexer
public abstract class Indexer
An abstract class that extends Thread to build a search index. This acts as a base class to be extended for various index types. The list of document fields may also be extended as necessary.
Note that this class is not reentrant.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static int |
ANALYZER_SIMPLE
An identifier for the SimpleAnalyzer used by the search engine. |
static int |
ANALYZER_STANDARD
An identifier for the StandardAnalyzer used by the search engine. |
static int |
ANALYZER_TYPE
The Analyzer type to be used by the search engine. |
protected boolean |
create
When true, indexing operations will create a new index from scratch rather than modifying an existing index. |
protected static org.apache.lucene.analysis.Analyzer |
m_analyzer
The Analyzer used by the search engine. |
protected File |
m_indexDirectory
The directory used by the search engine for storing its index. |
protected org.apache.lucene.index.IndexWriter |
m_writer
The IndexWriter used by the search engine. |
protected MessageHandler |
mh
|
protected MessageWriter |
mw
|
protected ProgressBar |
progress
|
static String |
SEARCH_INDEX_PATH
The identifier of the property containing the search index path. |
protected Services |
srvs
|
static int |
THREAD_PRIORITY
The default Thread priority (Thread.MAX_PRIORITY). |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Indexer(String name,
MessageWriter msgwriter)
Constructor with a name identifier (used by the thread group manager), the MessageWriter to receive indexing and search result messages, and a File reference for the index directory. |
|
| Method Summary | |
|---|---|
void |
closeIndex()
Close any open index writer. |
void |
deleteIndex()
Delete the built index of this Indexer. |
org.apache.lucene.analysis.Analyzer |
getAnalyzer()
Return the Analyzer to be used for indexing content. |
File |
getIndexDirectory()
Returns the index directory. |
org.apache.lucene.index.IndexReader |
getIndexReader()
Returns an IndexReader used to restore the index. |
org.apache.lucene.index.IndexWriter |
getIndexWriter()
Return the IndexWriter used by this XNodeIndexer. |
MessageHandler |
getMessageHandler()
Returns the MessageHandler, which receives general informational, log, warning and error messages. |
MessageWriter |
getMessageWriter()
Returns the MessageWriter, which displays index- and search-related messages directly to the user. |
ProgressBar |
getProgressBar()
Returns the optional ProgressBar, or null if it is not set. |
static String[] |
getStopWords()
Return the stop words being used by the analyzer. |
long |
getVersion()
Returns the index version number, -1 if it has not been set. |
boolean |
hasProgressBar()
Returns true if the optional ProgressBar has been set. |
void |
index(boolean createIndex)
Begins an indexing process. |
boolean |
isCreateIndex()
Returns true if the index should be created/recreated when the index is built/rebuilt, rather than just modified. |
boolean |
isIndexed()
Returns true if Indexer indicates an index completed state. |
void |
mergeIndex(Indexer indexer)
Merge the index provided by indexer with this index. |
abstract boolean |
restoreIndex()
Restore the existing index after opening a new session, returning true if successful. |
abstract void |
run()
|
void |
setCreateIndex(boolean createIndex)
Sets the property that when true indicates that when index are built, they should be built from scratch rather than just modified. |
void |
setIndexDirectory(File directory)
Sets the directory used to store the index. |
protected void |
setIsIndexed(boolean indexed)
Set the boolean value indicating an index completed/ready state. |
void |
setProgressBar(ProgressBar progressBar)
Sets an optional ProgressBar to indicate process status. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SEARCH_INDEX_PATH
public static final int ANALYZER_SIMPLE
public static final int ANALYZER_STANDARD
public static int ANALYZER_TYPE
ANALYZER_STANDARD.
protected org.apache.lucene.index.IndexWriter m_writer
protected static org.apache.lucene.analysis.Analyzer m_analyzer
protected File m_indexDirectory
public static int THREAD_PRIORITY
protected boolean create
protected ProgressBar progress
protected Services srvs
protected MessageWriter mw
protected MessageHandler mh
| Constructor Detail |
|---|
public Indexer(String name,
MessageWriter msgwriter)
| Method Detail |
|---|
public void index(boolean createIndex)
public abstract void run()
run in interface Runnablerun in class Thread
public org.apache.lucene.index.IndexReader getIndexReader()
throws IOException
IOExceptionprotected final void setIsIndexed(boolean indexed)
public final boolean isIndexed()
public final long getVersion()
public final boolean hasProgressBar()
public final void setProgressBar(ProgressBar progressBar)
public final ProgressBar getProgressBar()
public final MessageWriter getMessageWriter()
public final MessageHandler getMessageHandler()
public void setIndexDirectory(File directory)
throws IOException
IOException
public File getIndexDirectory()
throws IOException
IOExceptionpublic abstract boolean restoreIndex()
public final void setCreateIndex(boolean createIndex)
public final boolean isCreateIndex()
public org.apache.lucene.index.IndexWriter getIndexWriter()
public void deleteIndex()
public void mergeIndex(Indexer indexer)
public void closeIndex()
public org.apache.lucene.analysis.Analyzer getAnalyzer()
public static String[] getStopWords()
MessageId.STOP_WORDS. For English or other recognized
English-speaking Locales (ENGLISH, US, UK, and CANADA), this method returns null,
since the constructor for the Analyzer using the default has no parameters.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||