public final class IndexToolsImpl extends LukeModel implements IndexTools
IndexTools| Constructor and Description |
|---|
IndexToolsImpl(Directory dir,
boolean useCompound,
boolean keepAllCommits)
Constructs an IndexToolsImpl that holds given
Directory. |
IndexToolsImpl(IndexReader reader,
boolean useCompound,
boolean keepAllCommits)
Constructs an IndexToolsImpl that holds given
IndexReader. |
| Modifier and Type | Method and Description |
|---|---|
void |
addDocument(Document doc,
Analyzer analyzer)
Add new document to this index.
|
CheckIndex.Status |
checkIndex(PrintStream ps)
Check the current index status.
|
void |
createNewIndex()
Create a new index.
|
void |
createNewIndex(String dataDir)
Create a new index with sample documents.
|
void |
deleteDocuments(Query query)
Delete documents from this index by the specified query.
|
String |
exportTerms(String destDir,
String field,
String delimiter)
Export terms from given field into a new file on the destination directory
|
void |
optimize(boolean expunge,
int maxNumSegments,
PrintStream ps)
Execute force merges.
|
void |
repairIndex(CheckIndex.Status st,
PrintStream ps)
Try to repair the corrupted index using previously returned index status.
|
getFieldNamespublic IndexToolsImpl(Directory dir, boolean useCompound, boolean keepAllCommits)
Directory.dir - - the index directoryuseCompound - - if true, compound file format is usedkeepAllCommits - - if true, all commit points are reservedpublic IndexToolsImpl(IndexReader reader, boolean useCompound, boolean keepAllCommits)
IndexReader.reader - - the index readeruseCompound - - if true, compound file format is usedkeepAllCommits - - if true, all commit points are reservedpublic void optimize(boolean expunge,
int maxNumSegments,
PrintStream ps)
IndexTools
Merges are executed until there are maxNumSegments segments.
When expunge is true, maxNumSegments parameter is ignored.
optimize in interface IndexToolsexpunge - - if true, only segments having deleted documents are mergedmaxNumSegments - - max number of segmentsps - - information streampublic CheckIndex.Status checkIndex(PrintStream ps)
IndexToolscheckIndex in interface IndexToolsps - information streampublic void repairIndex(CheckIndex.Status st, PrintStream ps)
IndexToolsThis method must be called with the return value from IndexTools.checkIndex(PrintStream).
repairIndex in interface IndexToolsst - - index statusps - - information streampublic void addDocument(Document doc, Analyzer analyzer)
IndexToolsaddDocument in interface IndexToolsdoc - - document to be addedanalyzer - - analyzer for parsing to documentpublic void deleteDocuments(Query query)
IndexToolsdeleteDocuments in interface IndexToolsquery - - query for deletingpublic void createNewIndex()
IndexToolscreateNewIndex in interface IndexToolspublic void createNewIndex(String dataDir)
IndexToolscreateNewIndex in interface IndexToolsdataDir - - the directory path which contains sample documents (20 Newsgroups).public String exportTerms(String destDir, String field, String delimiter)
IndexToolsexportTerms in interface IndexToolsdestDir - - destination directoryfield - - field namedelimiter - - delimiter to separate terms and their frequencyCopyright © 2000-2024 Apache Software Foundation. All Rights Reserved.