public final class SimpleBindings extends Bindings
DoubleValuesSource
s
or other Expression
s.
Example usage:
SimpleBindings bindings = new SimpleBindings(); // document's text relevance score bindings.add("_score", DoubleValuesSource.SCORES); // integer NumericDocValues field bindings.add("popularity", DoubleValuesSource.fromIntField("popularity")); // 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)
Deprecated.
|
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
|
@Deprecated public void add(SortField sortField)
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-2021 Apache Software Foundation. All Rights Reserved.