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 |
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 void |
requestDocumentsWithWord(String word,
com.carrotsearch.hppc.IntArrayList documents) |
private void |
requestDocumentsWithWordAsSet(String word,
com.carrotsearch.hppc.IntOpenHashSet documents) |
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.CorruptIndexExceptionIOExceptionprivate void requestDocumentsWithWordAsSet(String word, com.carrotsearch.hppc.IntOpenHashSet documents)
public 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 storedprivate void requestDocumentsWithWord(String word, com.carrotsearch.hppc.IntArrayList documents)
Copyright © 2014–2016. All rights reserved.