public class LuceneInvertedIndex extends Object implements InvertedIndex
Modifier and Type | Class and Description |
---|---|
static class |
LuceneInvertedIndex.Builder |
Modifier and Type | Field and Description |
---|---|
static String |
WORD_FIELD |
Constructor and Description |
---|
LuceneInvertedIndex(VocabCache vocabCache,
boolean cache) |
Modifier and Type | Method and Description |
---|---|
void |
addWordsToDoc(int doc,
List<VocabWord> words)
Adds words to the given document
|
void |
addWordToDoc(int doc,
VocabWord word)
Add word to a document
|
Collection<Integer> |
allDocs()
Returns a list of all documents
|
List<VocabWord> |
document(int index)
Returns a list of words for a document
|
List<Integer> |
documents(VocabWord vocabWord)
Returns the list of documents a vocab word is in
|
void |
finish()
Finishes saving data
|
int |
numDocuments()
Returns the number of documents
|
public static final String WORD_FIELD
public LuceneInvertedIndex(VocabCache vocabCache, boolean cache)
public List<VocabWord> document(int index)
InvertedIndex
document
in interface InvertedIndex
public List<Integer> documents(VocabWord vocabWord)
InvertedIndex
documents
in interface InvertedIndex
vocabWord
- the vocab word to get documents forpublic int numDocuments()
InvertedIndex
numDocuments
in interface InvertedIndex
public Collection<Integer> allDocs()
InvertedIndex
allDocs
in interface InvertedIndex
public void addWordToDoc(int doc, VocabWord word)
InvertedIndex
addWordToDoc
in interface InvertedIndex
doc
- the document to add toword
- the word to addpublic void addWordsToDoc(int doc, List<VocabWord> words)
InvertedIndex
addWordsToDoc
in interface InvertedIndex
doc
- the document to add towords
- the words to addpublic void finish()
InvertedIndex
finish
in interface InvertedIndex
Copyright © 2014. All rights reserved.