|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tm4j.topicmap.index.text.LuceneIndexBase
INTERNAL Abstract base class for FullTextIndexes using lucene for TextIndexing Concrete Implementations have to set an analyzer and directory implementation before starting the indexing. For building the index, utility methods for common topicMapObjects are available ( addDocument(...) ) these creates fields for not locator data, and Locators from Occurrences, adds object ids as unindexed fields.
Field Summary | |
protected boolean |
createNew
|
protected org.apache.commons.logging.Log |
log
|
static java.lang.String |
OPT_LUCENE_ANALYZER
The configuration property key for the property that specifies the full Java class name of the Lucene Analyzer to use for the full text index. |
static java.lang.String |
OPT_LUCENE_DIR
The configuration property key for the property that specifies the path name of the file-system directory to use for the full text index. |
protected TopicMap |
topicMap
|
Fields inherited from interface org.tm4j.topicmap.index.text.FullTextIndex |
ID, LINK, PARENT_ID, VALUE |
Constructor Summary | |
protected |
LuceneIndexBase(TopicMap topicMap)
|
Method Summary | |
protected void |
addDocument(BaseName baseName)
|
protected void |
addDocument(Occurrence occurrence)
|
protected void |
addDocument(Topic topic)
|
protected void |
addDocument(Variant variant)
|
protected void |
buildIndex()
|
void |
close()
This method may cause the index to be dropped and any memory used to be freed. |
void |
configure(java.util.Properties props)
Runtime configuration method invoked by the ConfigurableIndexProvider class. |
protected org.apache.lucene.document.Document |
createDocument(TopicMapObject object)
|
QueryResult |
findByText(java.lang.String query,
boolean includeURIs)
This causes the FullTextIndex to be queried for the given query. |
org.apache.lucene.analysis.Analyzer |
getAnalyzer()
Access method for the used Lucene Analyzer |
org.apache.lucene.store.Directory |
getDir()
Access method for the used Lucene Directory |
boolean |
isOpen()
Determines whether or not the index is accessible. |
void |
open()
This method may cause the index to be initialised. |
void |
reindex()
This method may cause the index to be regenerated. |
void |
setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
Set Method for the used Lucene Analyzer |
void |
setDir(org.apache.lucene.store.Directory dir)
Set Method for the used Lucene Directory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String OPT_LUCENE_ANALYZER
public static final java.lang.String OPT_LUCENE_DIR
protected org.apache.commons.logging.Log log
protected TopicMap topicMap
protected boolean createNew
Constructor Detail |
protected LuceneIndexBase(TopicMap topicMap)
Method Detail |
public QueryResult findByText(java.lang.String query, boolean includeURIs) throws IndexException
FullTextIndex
findByText
in interface FullTextIndex
query
- the Query String following the FullTextEngine Query SyntaxincludeURIs
- wether to also index uri´s
IndexException
- thrown if no index is available or it is corruptedpublic void open() throws IndexException
Index
open
in interface Index
IndexException
- If some internal error prevents
the index from being opened.public boolean isOpen()
Index
isOpen
in interface Index
public void reindex() throws IndexException
Index
reindex
in interface Index
IndexException
- If some internal error prevents
the index from being regenerated.public void close() throws IndexException
Index
close
in interface Index
IndexException
protected void buildIndex() throws java.io.IOException
java.io.IOException
protected void addDocument(Topic topic) throws java.io.IOException
java.io.IOException
protected void addDocument(BaseName baseName) throws java.io.IOException
java.io.IOException
protected void addDocument(Variant variant) throws java.io.IOException
java.io.IOException
protected void addDocument(Occurrence occurrence) throws java.io.IOException
java.io.IOException
protected org.apache.lucene.document.Document createDocument(TopicMapObject object)
public org.apache.lucene.analysis.Analyzer getAnalyzer()
public void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
analyzer
- the new analyzerpublic org.apache.lucene.store.Directory getDir()
public void setDir(org.apache.lucene.store.Directory dir)
dir
- the new directorypublic void configure(java.util.Properties props) throws IndexConfigurationException
configure
in interface ConfigurableIndex
props
- the configuration properties passed to the
ConfigurableIndexProvider.
IndexConfigurationException
- if a directory name
was specified but the file-system directory index
could not be opened or created.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |