public class LuceneTools extends Object
IndexWriter
and IndexSearcher
.Constructor and Description |
---|
LuceneTools(org.apache.lucene.store.Directory indexDir,
org.apache.lucene.analysis.Analyzer analyzer)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
closeIndexSearcher()
Closes the IndexSearcher
|
void |
closeIndexWriter()
Closes the IndexWriter
|
protected void |
commitChanges()
Commits all pending changes to the index
|
protected void |
finalize() |
org.apache.lucene.analysis.Analyzer |
getAnalyzer()
Returns the Analyzer;
|
org.apache.lucene.search.IndexSearcher |
getIndexSearcher()
Returns a IndexSearcher
|
org.apache.lucene.index.IndexWriter |
getIndexWriter()
Return a IndexWriter
|
org.apache.lucene.index.IndexWriter |
getIndexWriter(boolean createDir)
Return a IndexWriter
|
void |
optimizeIndex()
Starts index optimization.
|
public LuceneTools(org.apache.lucene.store.Directory indexDir, org.apache.lucene.analysis.Analyzer analyzer)
indexDir
- the directory where the index is.analyzer
- the analyzer to use.public org.apache.lucene.index.IndexWriter getIndexWriter() throws RuntimeException
RuntimeException
public org.apache.lucene.index.IndexWriter getIndexWriter(boolean createDir)
createDir
- specifies the path to a directory where the index should be stored.public void closeIndexWriter()
public org.apache.lucene.search.IndexSearcher getIndexSearcher() throws RuntimeException
RuntimeException
public void closeIndexSearcher()
public org.apache.lucene.analysis.Analyzer getAnalyzer()
public void optimizeIndex()
protected void finalize() throws Throwable
protected void commitChanges()
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.