public interface LeafSearchScript extends ScorerAware, ExecutableScript
SearchScript
.
This is effectively a functional interface, requiring at least implementing runAsDouble()
.Modifier and Type | Method and Description |
---|---|
default java.lang.Object |
run()
Executes the script.
|
double |
runAsDouble()
Return the result as a double.
|
default long |
runAsLong()
Return the result as a long.
|
default void |
setDocument(int doc)
Set the document this script will process next.
|
default void |
setNextAggregationValue(java.lang.Object value)
Sets per-document aggregation
_value . |
default void |
setNextVar(java.lang.String field,
java.lang.Object value)
Sets a runtime script parameter.
|
default void |
setScorer(org.apache.lucene.search.Scorer scorer) |
default void |
setSource(java.util.Map<java.lang.String,java.lang.Object> source)
Set the source for the current document.
|
unwrap
default void setDocument(int doc)
default void setScorer(org.apache.lucene.search.Scorer scorer)
setScorer
in interface ScorerAware
default void setSource(java.util.Map<java.lang.String,java.lang.Object> source)
default void setNextAggregationValue(java.lang.Object value)
_value
.
The default implementation just calls setNextVar("_value", value)
but
some engines might want to handle this differently for better performance.
value
- per-document value, typically a String, Long, or Doubledefault void setNextVar(java.lang.String field, java.lang.Object value)
ExecutableScript
Note that this method may be slow, involving put() and get() calls to a hashmap or similar.
setNextVar
in interface ExecutableScript
field
- parameter namevalue
- parameter valuedefault long runAsLong()
default java.lang.Object run()
ExecutableScript
run
in interface ExecutableScript
double runAsDouble()