Interface IndexTools
-
- All Known Implementing Classes:
IndexToolsImpl
public interface IndexToolsA dedicated interface for Luke's various index manipulations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddDocument(Document doc, Analyzer analyzer)Add new document to this index.CheckIndex.StatuscheckIndex(PrintStream ps)Check the current index status.voidcreateNewIndex()Create a new index.voidcreateNewIndex(String dataDir)Create a new index with sample documents.voiddeleteDocuments(Query query)Delete documents from this index by the specified query.StringexportTerms(String destDir, String field, String delimiter)Export terms from given field into a new file on the destination directoryvoidoptimize(boolean expunge, int maxNumSegments, PrintStream ps)Execute force merges.voidrepairIndex(CheckIndex.Status st, PrintStream ps)Try to repair the corrupted index using previously returned index status.
-
-
-
Method Detail
-
optimize
void optimize(boolean expunge, int maxNumSegments, PrintStream ps)Execute force merges.Merges are executed until there are maxNumSegments segments.
When expunge is true, maxNumSegments parameter is ignored.- Parameters:
expunge- - if true, only segments having deleted documents are mergedmaxNumSegments- - max number of segmentsps- - information stream- Throws:
LukeException- - if an internal error occurs when accessing index
-
checkIndex
CheckIndex.Status checkIndex(PrintStream ps)
Check the current index status.- Parameters:
ps- information stream- Returns:
- index status
- Throws:
LukeException- - if an internal error occurs when accessing index
-
repairIndex
void repairIndex(CheckIndex.Status st, PrintStream ps)
Try to repair the corrupted index using previously returned index status.This method must be called with the return value from
checkIndex(PrintStream).- Parameters:
st- - index statusps- - information stream- Throws:
LukeException- - if an internal error occurs when accessing index
-
addDocument
void addDocument(Document doc, Analyzer analyzer)
Add new document to this index.- Parameters:
doc- - document to be addedanalyzer- - analyzer for parsing to document- Throws:
LukeException- - if an internal error occurs when accessing index
-
deleteDocuments
void deleteDocuments(Query query)
Delete documents from this index by the specified query.- Parameters:
query- - query for deleting- Throws:
LukeException- - if an internal error occurs when accessing index
-
createNewIndex
void createNewIndex()
Create a new index.- Throws:
LukeException- - if an internal error occurs when accessing index
-
createNewIndex
void createNewIndex(String dataDir)
Create a new index with sample documents.- Parameters:
dataDir- - the directory path which contains sample documents (20 Newsgroups).
-
exportTerms
String exportTerms(String destDir, String field, String delimiter)
Export terms from given field into a new file on the destination directory- Parameters:
destDir- - destination directoryfield- - field namedelimiter- - delimiter to separate terms and their frequency- Returns:
- The file containing the export
-
-