Class SimpleBindings
Simple class that binds expression variable names to Lucene.Net.Search.SortFields or other Expressions.
Example usage:SimpleBindings bindings = new SimpleBindings
{
// document's text relevance score
new SortField("_score", SortFieldType.SCORE),
// integer NumericDocValues field (or from FieldCache)
new SortField("popularity", SortFieldType.INT),
// another expression
{ "recency", myRecencyExpression },
};
// create a sort field in reverse order
Sort sort = new Sort(expr.GetSortField(bindings, true));
Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Expressions
Assembly: Lucene.Net.Expressions.dll
Syntax
public sealed class SimpleBindings : Bindings, IEnumerable<KeyValuePair<string, object>>, IEnumerable
Constructors
SimpleBindings()
Creates a new empty Bindings
Declaration
public SimpleBindings()
Methods
Add(SortField)
Adds a Lucene.Net.Search.SortField to the bindings.
Declaration
public void Add(SortField sortField)
Parameters
Type | Name | Description |
---|---|---|
SortField | sortField |
Remarks
Adds a Lucene.Net.Search.SortField to the bindings.
This can be used to reference a DocValuesField, a field from FieldCache, the document's score, etc.Add(string, Expression)
Adds an Expression to the bindings.
Declaration
public void Add(string name, Expression expression)
Parameters
Type | Name | Description |
---|---|---|
string | name | |
Expression | expression |
Remarks
Adds an Expression to the bindings.
This can be used to reference expressions from other expressions.GetValueSource(string)
Returns a Lucene.Net.Queries.Function.ValueSource bound to the variable name.
Declaration
public override ValueSource GetValueSource(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
ValueSource |
Overrides
Validate()
Traverses the graph of bindings, checking there are no cycles or missing references
Declaration
public void Validate()
Exceptions
Type | Condition |
---|---|
ArgumentException | if the bindings is inconsistent |