public abstract class AbstractSearchScript extends AbstractExecutableScript implements SearchScript
If the script returns a specific numeric type, consider overriding the type specific base classes
such as AbstractDoubleSearchScript
, AbstractFloatSearchScript
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 DocLookup |
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(String field)
Returns field data double (floating point) access for the provided field.
|
protected ScriptDocValues.Longs |
docFieldLongs(String field)
Returns field data long (integers) access for the provided field.
|
protected ScriptDocValues.Strings |
docFieldStrings(String field)
Returns field data strings access for the provided field.
|
protected FieldsLookup |
fields()
Allows to access the *stored* fields.
|
protected IndexLookup |
indexLookup()
Allows to access statistics on terms and fields.
|
double |
runAsDouble() |
float |
runAsFloat() |
long |
runAsLong() |
protected float |
score()
Returns the current score and only applicable when used as a scoring script in a custom score query!.
|
void |
setNextDocId(int doc) |
void |
setNextReader(org.apache.lucene.index.AtomicReaderContext context) |
void |
setNextSource(Map<String,Object> source) |
void |
setScorer(org.apache.lucene.search.Scorer scorer) |
protected SourceLookup |
source()
Allows to access the actual source (loaded and parsed).
|
setNextVar, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run, setNextVar, unwrap
protected final DocLookup doc()
protected final float score() throws IOException
IOException
protected ScriptDocValues.Strings docFieldStrings(String field)
protected ScriptDocValues.Doubles docFieldDoubles(String field)
protected ScriptDocValues.Longs docFieldLongs(String field)
protected final SourceLookup source()
protected final IndexLookup indexLookup()
protected final FieldsLookup fields()
public void setScorer(org.apache.lucene.search.Scorer scorer)
setScorer
in interface ScorerAware
public void setNextReader(org.apache.lucene.index.AtomicReaderContext context)
setNextReader
in interface ReaderContextAware
public void setNextDocId(int doc)
setNextDocId
in interface SearchScript
public void setNextSource(Map<String,Object> source)
setNextSource
in interface SearchScript
public float runAsFloat()
runAsFloat
in interface SearchScript
public long runAsLong()
runAsLong
in interface SearchScript
public double runAsDouble()
runAsDouble
in interface SearchScript
Copyright © 2009–2015. All rights reserved.