Class DocumentValueSourceDictionary
Dictionary with terms and optionally payload 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 Lucene.Net.Queries.Function.ValueSource.
NOTE:- The term and (optionally) payload fields have to be stored
- if the term or (optionally) payload fields supplied do not have a value for a document, then the document is rejected by the dictionary
In practice the Lucene.Net.Queries.Function.ValueSource will likely be obtained using the lucene expression module. The following example shows how to create a Lucene.Net.Queries.Function.ValueSource from a simple addition of two fields:
Expression expression = JavascriptCompiler.Compile("f1 + f2");
SimpleBindings bindings = new SimpleBindings();
bindings.Add(new SortField("f1", SortField.Type_e.LONG));
bindings.Add(new SortField("f2", SortField.Type_e.LONG));
ValueSource valueSource = expression.GetValueSource(bindings);
Implements
Inherited Members
Namespace: Lucene.Net.Search.Suggest
Assembly: Lucene.Net.Suggest.dll
Syntax
public class DocumentValueSourceDictionary : DocumentDictionary, IDictionary
Constructors
DocumentValueSourceDictionary(IndexReader, string, ValueSource)
Creates a new dictionary with the contents of the fields named field
for the terms and uses the weightsValueSource
supplied to determine the
score.
Declaration
public DocumentValueSourceDictionary(IndexReader reader, string field, ValueSource weightsValueSource)
Parameters
Type | Name | Description |
---|---|---|
IndexReader | reader | |
string | field | |
ValueSource | weightsValueSource |
DocumentValueSourceDictionary(IndexReader, string, ValueSource, string)
Creates a new dictionary with the contents of the fields named field
for the terms, payload
for the corresponding payloads
and uses the weightsValueSource
supplied to determine the
score.
Declaration
public DocumentValueSourceDictionary(IndexReader reader, string field, ValueSource weightsValueSource, string payload)
Parameters
Type | Name | Description |
---|---|---|
IndexReader | reader | |
string | field | |
ValueSource | weightsValueSource | |
string | payload |
DocumentValueSourceDictionary(IndexReader, string, ValueSource, string, string)
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.
Declaration
public DocumentValueSourceDictionary(IndexReader reader, string field, ValueSource weightsValueSource, string payload, string contexts)
Parameters
Type | Name | Description |
---|---|---|
IndexReader | reader | |
string | field | |
ValueSource | weightsValueSource | |
string | payload | |
string | contexts |
Methods
GetEntryEnumerator()
Returns an enumerator over all the entries.
Declaration
public override IInputEnumerator GetEntryEnumerator()
Returns
Type | Description |
---|---|
IInputEnumerator | Enumerator |