public final class SimpleBindings extends Bindings
SortFields
or other Expressions.
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
|
getScoreValueSourcepublic 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)
BindingsgetValueSource in class Bindingspublic void validate()
IllegalArgumentException - if the bindings is inconsistentCopyright © 2000-2014 Apache Software Foundation. All Rights Reserved.