public class LuceneCorpusAdapter extends Object implements BooleanDocumentSupportingAdapter
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.lucene.index.AtomicReaderContext[] |
contexts |
protected org.apache.lucene.index.DirectoryReader |
dirReader |
protected String |
fieldName |
private static org.slf4j.Logger |
LOGGER |
protected org.apache.lucene.index.AtomicReader[] |
reader |
| Modifier | Constructor and Description |
|---|---|
protected |
LuceneCorpusAdapter(org.apache.lucene.index.DirectoryReader dirReader,
org.apache.lucene.index.AtomicReader[] reader,
org.apache.lucene.index.AtomicReaderContext[] contexts,
String fieldName) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the Lucene index.
|
static LuceneCorpusAdapter |
create(String indexPath,
String fieldName)
Creates a corpus adapter which uses the Lucene index with the given path
and searches on the field with the given field name.
|
void |
getDocumentsWithWord(String word,
com.carrotsearch.hppc.IntArrayList documents)
Determines the documents containing the given word.
|
void |
getDocumentsWithWordAsSet(String word,
com.carrotsearch.hppc.IntOpenHashSet documents)
Determines the documents containing the given word.
|
void |
getDocumentsWithWords(com.carrotsearch.hppc.ObjectObjectOpenHashMap<String,com.carrotsearch.hppc.IntArrayList> wordDocMapping)
Determines the documents containing the words used as key in the given
map.
|
void |
getDocumentsWithWordsAsSet(com.carrotsearch.hppc.ObjectObjectOpenHashMap<String,com.carrotsearch.hppc.IntOpenHashSet> wordDocMapping)
Determines the documents containing the words used as key in the given
map.
|
int |
getNumberOfDocuments()
Returns the number of documents the corpus contains.
|
private static final org.slf4j.Logger LOGGER
protected String fieldName
protected org.apache.lucene.index.DirectoryReader dirReader
protected org.apache.lucene.index.AtomicReader[] reader
protected org.apache.lucene.index.AtomicReaderContext[] contexts
protected LuceneCorpusAdapter(org.apache.lucene.index.DirectoryReader dirReader,
org.apache.lucene.index.AtomicReader[] reader,
org.apache.lucene.index.AtomicReaderContext[] contexts,
String fieldName)
public static LuceneCorpusAdapter create(String indexPath, String fieldName) throws org.apache.lucene.index.CorruptIndexException, IOException
indexPath - fieldName - org.apache.lucene.index.CorruptIndexExceptionIOExceptionpublic void getDocumentsWithWordAsSet(String word, com.carrotsearch.hppc.IntOpenHashSet documents)
BooleanDocumentSupportingAdaptergetDocumentsWithWordAsSet in interface BooleanDocumentSupportingAdapterword - the word which should be searcheddocuments - the set in which the document ids will be storedpublic void close()
close in interface CorpusAdapterpublic int getNumberOfDocuments()
BooleanDocumentSupportingAdaptergetNumberOfDocuments in interface BooleanDocumentSupportingAdapterpublic void getDocumentsWithWordsAsSet(com.carrotsearch.hppc.ObjectObjectOpenHashMap<String,com.carrotsearch.hppc.IntOpenHashSet> wordDocMapping)
BooleanDocumentSupportingAdaptergetDocumentsWithWordsAsSet in interface BooleanDocumentSupportingAdapterwordDocMapping - a mapping of words to documents in which the results are
storedpublic void getDocumentsWithWords(com.carrotsearch.hppc.ObjectObjectOpenHashMap<String,com.carrotsearch.hppc.IntArrayList> wordDocMapping)
BooleanDocumentSupportingAdaptergetDocumentsWithWords in interface BooleanDocumentSupportingAdapterwordDocMapping - a mapping of words to documents in which the results are
storedpublic void getDocumentsWithWord(String word, com.carrotsearch.hppc.IntArrayList documents)
BooleanDocumentSupportingAdaptergetDocumentsWithWord in interface BooleanDocumentSupportingAdapterword - the word which should be searcheddocuments - the list to the document ids will be addedCopyright © 2014–2016. All rights reserved.