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
public class DocumentDictionary extends Object implements Dictionary
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 Modifier and Type Class Description protected class
DocumentDictionary.DocumentInputIterator
ImplementsInputIterator
from stored fields.
-
Field Summary
Fields Modifier and Type Field Description protected String
contextsField
Field to read contexts fromprotected String
payloadField
Field to read payload fromprotected IndexReader
reader
IndexReader
to load documents from
-
Constructor Summary
Constructors Constructor Description DocumentDictionary(IndexReader reader, String field, String weightField)
Creates a new dictionary with the contents of the fields namedfield
for the terms andweightField
for 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 namedfield
for the terms,weightField
for the weights that will be used for the the corresponding terms andpayloadField
for 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 namedfield
for the terms,weightField
for the weights that will be used for the the corresponding terms,payloadField
for the corresponding payloads for the entry andcontextsField
for associated contexts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputIterator
getEntryIterator()
Returns an iterator over all the entries
-
-
-
Field Detail
-
reader
protected final IndexReader reader
IndexReader
to load documents from
-
payloadField
protected final String payloadField
Field to read payload from
-
contextsField
protected final String contextsField
Field to read contexts from
-
-
Constructor Detail
-
DocumentDictionary
public DocumentDictionary(IndexReader reader, String field, String weightField)
Creates a new dictionary with the contents of the fields namedfield
for the terms andweightField
for the weights that will be used for the corresponding terms.
-
DocumentDictionary
public DocumentDictionary(IndexReader reader, String field, String weightField, String payloadField)
Creates a new dictionary with the contents of the fields namedfield
for the terms,weightField
for the weights that will be used for the the corresponding terms andpayloadField
for the corresponding payloads for the entry.
-
DocumentDictionary
public DocumentDictionary(IndexReader reader, String field, String weightField, String payloadField, String contextsField)
Creates a new dictionary with the contents of the fields namedfield
for the terms,weightField
for the weights that will be used for the the corresponding terms,payloadField
for the corresponding payloads for the entry andcontextsField
for associated contexts.
-
-
Method Detail
-
getEntryIterator
public InputIterator getEntryIterator() throws IOException
Description copied from interface:Dictionary
Returns an iterator over all the entries- Specified by:
getEntryIterator
in interfaceDictionary
- Returns:
- Iterator
- Throws:
IOException
-
-