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.
|
getFieldNames
public 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 IndexTools
expunge
- - if true, only segments having deleted documents are mergedmaxNumSegments
- - max number of segmentsps
- - information streampublic CheckIndex.Status checkIndex(PrintStream ps)
IndexTools
checkIndex
in interface IndexTools
ps
- information streampublic void repairIndex(CheckIndex.Status st, PrintStream ps)
IndexTools
This method must be called with the return value from IndexTools.checkIndex(PrintStream)
.
repairIndex
in interface IndexTools
st
- - index statusps
- - information streampublic void addDocument(Document doc, Analyzer analyzer)
IndexTools
addDocument
in interface IndexTools
doc
- - document to be addedanalyzer
- - analyzer for parsing to documentpublic void deleteDocuments(Query query)
IndexTools
deleteDocuments
in interface IndexTools
query
- - query for deletingpublic void createNewIndex()
IndexTools
createNewIndex
in interface IndexTools
public void createNewIndex(String dataDir)
IndexTools
createNewIndex
in interface IndexTools
dataDir
- - the directory path which contains sample documents (20 Newsgroups).public String exportTerms(String destDir, String field, String delimiter)
IndexTools
exportTerms
in interface IndexTools
destDir
- - destination directoryfield
- - field namedelimiter
- - delimiter to separate terms and their frequencyCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.