public final class SimpleBindings extends Bindings
SortField
s
or other Expression
s.
Example usage:
SimpleBindings bindings = new SimpleBindings(); // document's text relevance score bindings.add(new SortField("_score", SortField.Type.SCORE)); // integer NumericDocValues field (or from FieldCache) bindings.add(new SortField("popularity", SortField.Type.INT)); // another expression bindings.add("recency", myRecencyExpression); // create a sort field in reverse order Sort sort = new Sort(expr.getSortField(bindings, true));
Constructor and Description |
---|
SimpleBindings()
Creates a new empty Bindings
|
Modifier and Type | Method and Description |
---|---|
void |
add(SortField sortField)
Adds a SortField to the bindings.
|
void |
add(String name,
Expression expression)
Adds an Expression to the bindings.
|
ValueSource |
getValueSource(String name)
Returns a ValueSource bound to the variable name.
|
void |
validate()
Traverses the graph of bindings, checking there are no cycles or missing references
|
getScoreValueSource
public void add(SortField sortField)
This can be used to reference a DocValuesField, a field from FieldCache, the document's score, etc.
public void add(String name, Expression expression)
This can be used to reference expressions from other expressions.
public ValueSource getValueSource(String name)
Bindings
getValueSource
in class Bindings
public void validate()
IllegalArgumentException
- if the bindings is inconsistentCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.