Namespace Lucene.Net.Expressions
The Expressions Module for Apache Lucene
The expressions module is new to Lucene 4.6. It provides an API for dynamically computing per-document values based on string expressions.
The module is organized in two sections: 1. Lucene.Net.Expressions - The abstractions and simple utilities for common operations like sorting on an expression 2. <xref:Lucene.Net.Expressions.Js> - A compiler for a subset of JavaScript expressions
For sample code showing how to use the API, see Expression.
Classes
Bindings
Binds variable names in expressions to actual data.
Expression
Base class that computes the value of an expression for a document.
SimpleBindings
Simple class that binds expression variable names to 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