|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.lucene.expressions.Bindings
org.apache.lucene.expressions.SimpleBindings
public final class 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", 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 Summary | |
|---|---|
SimpleBindings()
Creates a new empty Bindings |
|
| Method Summary | |
|---|---|
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 |
| Methods inherited from class org.apache.lucene.expressions.Bindings |
|---|
getScoreValueSource |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleBindings()
| Method Detail |
|---|
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 Bindingspublic void validate()
IllegalArgumentException - if the bindings is inconsistent
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||