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
bindings.Add(new SortField("_score", SortFieldType.SCORE));
// integer NumericDocValues field (or from FieldCache)
bindings.Add(new SortField("popularity", SortFieldType.INT));
// another expression
bindings.Add("recency", myRecencyExpression);
// create a sort field in reverse order
Sort sort = new Sort(expr.GetSortField(bindings, true));
This is a Lucene.NET EXPERIMENTAL API, use at your own risk
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Lucene.Net.Expressions
Assembly: Lucene.Net.Expressions.dll
Syntax
public sealed class SimpleBindings : Bindings
Constructors
| Improve this Doc View SourceSimpleBindings()
Creates a new empty Bindings
Declaration
public SimpleBindings()
Methods
| Improve this Doc View SourceAdd(SortField)
Adds a Lucene.Net.Search.SortField to the bindings.
Declaration
public void Add(SortField sortField)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Search.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 |
---|---|---|
System.String | name | |
Expression | expression |
Remarks
Adds an Expression to the bindings.
This can be used to reference expressions from other expressions.
GetValueSource(String)
Declaration
public override ValueSource GetValueSource(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
Lucene.Net.Queries.Function.ValueSource |
Overrides
| Improve this Doc View SourceValidate()
Traverses the graph of bindings, checking there are no cycles or missing references
Declaration
public void Validate()
Exceptions
Type | Condition |
---|---|
System.ArgumentException | if the bindings is inconsistent |