public abstract class AbstractSearchScript extends AbstractExecutableScript implements LeafSearchScript
If the script returns a specific numeric type, consider overriding the type specific base classes
such as AbstractDoubleSearchScript
and AbstractLongSearchScript
for better performance.
The use is required to implement the ExecutableScript.run()
method.
Constructor and Description |
---|
AbstractSearchScript() |
Modifier and Type | Method and Description |
---|---|
protected LeafDocLookup |
doc()
Returns the doc lookup allowing to access field data (cached) values as well as the current document score
(where applicable).
|
protected ScriptDocValues.Doubles |
docFieldDoubles(java.lang.String field)
Returns field data double (floating point) access for the provided field.
|
protected ScriptDocValues.Longs |
docFieldLongs(java.lang.String field)
Returns field data long (integers) access for the provided field.
|
protected ScriptDocValues.Strings |
docFieldStrings(java.lang.String field)
Returns field data strings access for the provided field.
|
protected LeafFieldsLookup |
fields()
Allows to access the *stored* fields.
|
protected LeafIndexLookup |
indexLookup()
Allows to access statistics on terms and fields.
|
double |
runAsDouble()
Return the result as a double.
|
long |
runAsLong()
Return the result as a long.
|
protected float |
score()
Returns the current score and only applicable when used as a scoring script in a custom score query!.
|
void |
setDocument(int doc)
Set the document this script will process next.
|
void |
setScorer(org.apache.lucene.search.Scorer scorer) |
void |
setSource(java.util.Map<java.lang.String,java.lang.Object> source)
Set the source for the current document.
|
protected SourceLookup |
source()
Allows to access the actual source (loaded and parsed).
|
setNextVar
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run, setNextAggregationValue, setNextVar
unwrap
protected final LeafDocLookup doc()
protected final float score() throws java.io.IOException
java.io.IOException
protected ScriptDocValues.Strings docFieldStrings(java.lang.String field)
protected ScriptDocValues.Doubles docFieldDoubles(java.lang.String field)
protected ScriptDocValues.Longs docFieldLongs(java.lang.String field)
protected final SourceLookup source()
protected final LeafIndexLookup indexLookup()
protected final LeafFieldsLookup fields()
public void setScorer(org.apache.lucene.search.Scorer scorer)
setScorer
in interface ScorerAware
setScorer
in interface LeafSearchScript
public void setDocument(int doc)
LeafSearchScript
setDocument
in interface LeafSearchScript
public void setSource(java.util.Map<java.lang.String,java.lang.Object> source)
LeafSearchScript
setSource
in interface LeafSearchScript
public long runAsLong()
LeafSearchScript
runAsLong
in interface LeafSearchScript
public double runAsDouble()
LeafSearchScript
runAsDouble
in interface LeafSearchScript