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 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,
DoubleValuesSource source)
Bind a
DoubleValuesSource directly to the given name. |
void |
add(String name,
Expression expression)
Adds an Expression to the bindings.
|
DoubleValuesSource |
getDoubleValuesSource(String name)
Returns a DoubleValuesSource bound to the variable name
|
void |
validate()
Traverses the graph of bindings, checking there are no cycles or missing references
|
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, DoubleValuesSource source)
DoubleValuesSource
directly to the given name.public void add(String name, Expression expression)
This can be used to reference expressions from other expressions.
public DoubleValuesSource getDoubleValuesSource(String name)
Bindings
getDoubleValuesSource
in class Bindings
public void validate()
IllegalArgumentException
- if the bindings is inconsistentCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.