Interface IndexTools
-
- All Known Implementing Classes:
IndexToolsImpl
public interface IndexTools
A dedicated interface for Luke's various index manipulations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.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.
-
-
-
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).
-
-