Package org.apache.lucene.search.suggest
Class DocumentDictionary
java.lang.Object
org.apache.lucene.search.suggest.DocumentDictionary
- All Implemented Interfaces:
Dictionary
- Direct Known Subclasses:
DocumentValueSourceDictionary
Dictionary with terms, weights, payload (optional) and contexts (optional) information taken from
stored/indexed fields in a Lucene index. NOTE:
- The term field has to be stored; if it is missing, the document is skipped.
- The payload and contexts field are optional and are not required to be stored.
- The weight field can be stored or can be a
NumericDocValues. If the weight field is not defined, the value of the weight is0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringField to read contexts fromprotected final StringField to read payload fromprotected final IndexReaderIndexReaderto load documents fromprotected final StoredFieldsStoredFieldsfor this reader -
Constructor Summary
ConstructorsConstructorDescriptionDocumentDictionary(IndexReader reader, String field, String weightField) Creates a new dictionary with the contents of the fields namedfieldfor the terms andweightFieldfor the weights that will be used for the corresponding terms.DocumentDictionary(IndexReader reader, String field, String weightField, String payloadField) Creates a new dictionary with the contents of the fields namedfieldfor the terms,weightFieldfor the weights that will be used for the corresponding terms andpayloadFieldfor the corresponding payloads for the entry.DocumentDictionary(IndexReader reader, String field, String weightField, String payloadField, String contextsField) Creates a new dictionary with the contents of the fields namedfieldfor the terms,weightFieldfor the weights that will be used for the corresponding terms,payloadFieldfor the corresponding payloads for the entry andcontextsFieldfor associated contexts. -
Method Summary
Modifier and TypeMethodDescriptionReturns an iterator over all the entries
-
Field Details
-
reader
IndexReaderto load documents from -
storedFields
StoredFieldsfor this reader -
payloadField
Field to read payload from -
contextsField
Field to read contexts from
-
-
Constructor Details
-
DocumentDictionary
Creates a new dictionary with the contents of the fields namedfieldfor the terms andweightFieldfor the weights that will be used for the corresponding terms.- Throws:
IOException
-
DocumentDictionary
public DocumentDictionary(IndexReader reader, String field, String weightField, String payloadField) throws IOException Creates a new dictionary with the contents of the fields namedfieldfor the terms,weightFieldfor the weights that will be used for the corresponding terms andpayloadFieldfor the corresponding payloads for the entry.- Throws:
IOException
-
DocumentDictionary
public DocumentDictionary(IndexReader reader, String field, String weightField, String payloadField, String contextsField) throws IOException Creates a new dictionary with the contents of the fields namedfieldfor the terms,weightFieldfor the weights that will be used for the corresponding terms,payloadFieldfor the corresponding payloads for the entry andcontextsFieldfor associated contexts.- Throws:
IOException
-
-
Method Details
-
getEntryIterator
Description copied from interface:DictionaryReturns an iterator over all the entries- Specified by:
getEntryIteratorin interfaceDictionary- Returns:
- Iterator
- Throws:
IOException
-