public class DocumentValueSourceDictionary extends DocumentDictionary
Dictionary with terms and optionally payload and
optionally contexts information
taken from stored fields in a Lucene index. Similar to
DocumentDictionary
, except it obtains the weight
of the terms in a document based on a LongValuesSource
.
In practice the LongValuesSource
will likely be obtained
using the lucene expression module. The following example shows
how to create a LongValuesSource
from a simple addition of two
fields:
Expression expression = JavascriptCompiler.compile("f1 + f2");
SimpleBindings bindings = new SimpleBindings();
bindings.add(new SortField("f1", SortField.Type.LONG));
bindings.add(new SortField("f2", SortField.Type.LONG));
LongValuesSource valueSource = expression.getDoubleValuesSource(bindings).toLongValuesSource();
DocumentDictionary.DocumentInputIterator
contextsField, payloadField, reader
Constructor and Description |
---|
DocumentValueSourceDictionary(IndexReader reader,
String field,
LongValuesSource weightsValueSource)
Creates a new dictionary with the contents of the fields named
field
for the terms and uses the weightsValueSource supplied to determine the
score. |
DocumentValueSourceDictionary(IndexReader reader,
String field,
LongValuesSource weightsValueSource,
String payload)
Creates a new dictionary with the contents of the fields named
field
for the terms, payloadField for the corresponding payloads
and uses the weightsValueSource supplied to determine the
score. |
DocumentValueSourceDictionary(IndexReader reader,
String field,
LongValuesSource weightsValueSource,
String payload,
String contexts)
Creates a new dictionary with the contents of the fields named
field
for the terms, payload for the corresponding payloads, contexts
for the associated contexts and uses the weightsValueSource supplied
to determine the score. |
Modifier and Type | Method and Description |
---|---|
InputIterator |
getEntryIterator()
Returns an iterator over all the entries
|
public DocumentValueSourceDictionary(IndexReader reader, String field, LongValuesSource weightsValueSource, String payload, String contexts)
field
for the terms, payload
for the corresponding payloads, contexts
for the associated contexts and uses the weightsValueSource
supplied
to determine the score.public DocumentValueSourceDictionary(IndexReader reader, String field, LongValuesSource weightsValueSource, String payload)
field
for the terms, payloadField
for the corresponding payloads
and uses the weightsValueSource
supplied to determine the
score.public DocumentValueSourceDictionary(IndexReader reader, String field, LongValuesSource weightsValueSource)
field
for the terms and uses the weightsValueSource
supplied to determine the
score.public InputIterator getEntryIterator() throws IOException
Dictionary
getEntryIterator
in interface Dictionary
getEntryIterator
in class DocumentDictionary
IOException
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.