public class XtfSearcher
extends Object
Modifier and Type | Field and Description |
---|---|
private CharMap |
accentMap
Map of accented chars to remove diacritics from
|
private int |
chunkOverlap
Amount of overlap, in words, between adjacent chunks
|
private int |
chunkSize
Max # of words in a chunk
|
private long |
curVersion
Version number of the index in memory
|
private Directory |
directory
The index directory to read from
|
private DocNumMap |
docNumMap
Keeps track of which chunks belong to which documents
|
private Set |
indexedFields
Set of all indexed fields in the index
|
private String |
indexPath
Path to the index directory
|
private IndexReader |
indexReader
Reader used to access the index
|
private boolean |
isSparse
Whether this index is "sparse" (i.e. more than 5 chunks per doc)
|
private long |
lastCheckTime
Last time we checked for out-of-date
|
private long |
newVersion
Version number of index on disk
|
private WordMap |
pluralMap
Map of plural words to singular words
|
private SpellReader |
spellReader
Fetching spelling suggestions
|
private Set |
stopSet
Stop-words associated with the index (e.g.
|
private Set |
tokenizedFields
Set of all fields which are tokenized in the index
|
private long |
updatePeriod
How often to check for an out-of-date directory
|
Constructor and Description |
---|
XtfSearcher(String indexPath,
Directory dir,
int updateCheckSeconds)
Construct a searcher set on the given directory.
|
XtfSearcher(String indexPath,
int updateCheckSeconds)
Construct a searcher set on the given directory.
|
Modifier and Type | Method and Description |
---|---|
CharMap |
accentMap()
Find out the accent mapping, or null if none.
|
int |
chunkOverlap()
Find out how many words adjacent chunks can overlap.
|
int |
chunkSize()
Find out how many words (max) are in a chunk.
|
void |
close()
Close down the searcher and all its dependencies.
|
DocNumMap |
docNumMap()
Gets a map for translating chunk IDs to document IDs (and vice-versa)
|
Set |
indexedFields()
Gets the set of all fields that have been indexed.
|
IndexReader |
indexReader()
Gets the reader this searcher is using to read indexes.
|
boolean |
isSparse()
Find out if the index is sparse (i.e. more than 5 chunks per doc)
|
boolean |
isUpToDate()
Check if the version we have in memory is up-to-date relative to that
on disk.
|
WordMap |
pluralMap()
Find out the plural mapping, or null if none.
|
static LinkedHashSet |
readTokenizedFields(String indexPath,
IndexReader indexReader)
Read in the list of fields that are tokenized in this index.
|
SpellReader |
spellReader() |
Set |
stopSet()
Find out the set of stop words, or null if none.
|
Set |
tokenizedFields()
Get the list of all tokenized fields.
|
void |
update()
Ensures that this searcher is up-to-date with regards to the index on
disk.
|
private String indexPath
private Directory directory
private long updatePeriod
private long lastCheckTime
private long curVersion
private long newVersion
private IndexReader indexReader
private DocNumMap docNumMap
private SpellReader spellReader
private int chunkSize
private int chunkOverlap
private Set stopSet
private WordMap pluralMap
private CharMap accentMap
private Set indexedFields
private Set tokenizedFields
private boolean isSparse
public XtfSearcher(String indexPath, int updateCheckSeconds) throws IOException
indexPath
- Directory to load index data fromupdateCheckSeconds
- How often to check for an updated indexIOException
public XtfSearcher(String indexPath, Directory dir, int updateCheckSeconds) throws IOException
indexPath
- Path to index directorydir
- Lucene version of the index directoryupdateCheckSeconds
- How often to check for an updated indexIOException
public boolean isUpToDate() throws IOException
IOException
public void update() throws IOException
IOException
public static LinkedHashSet readTokenizedFields(String indexPath, IndexReader indexReader) throws IOException
IOException
public Set tokenizedFields()
public IndexReader indexReader()
public Set indexedFields()
public DocNumMap docNumMap()
public int chunkSize()
public int chunkOverlap()
public Set stopSet()
public WordMap pluralMap()
public CharMap accentMap()
public SpellReader spellReader()
public boolean isSparse()
public void close() throws IOException
IOException