Class AbstractScriptFieldQuery<S extends AbstractFieldScript>

java.lang.Object
org.apache.lucene.search.Query
org.elasticsearch.search.runtime.AbstractScriptFieldQuery<S>
Direct Known Subclasses:
AbstractStringScriptFieldAutomatonQuery, BooleanScriptFieldExistsQuery, BooleanScriptFieldTermQuery, DoubleScriptFieldExistsQuery, DoubleScriptFieldRangeQuery, DoubleScriptFieldTermQuery, DoubleScriptFieldTermsQuery, GeoPointScriptFieldDistanceFeatureQuery, GeoPointScriptFieldExistsQuery, GeoPointScriptFieldGeoShapeQuery, IpScriptFieldExistsQuery, IpScriptFieldRangeQuery, IpScriptFieldTermQuery, IpScriptFieldTermsQuery, LongScriptFieldDistanceFeatureQuery, LongScriptFieldExistsQuery, LongScriptFieldRangeQuery, LongScriptFieldTermQuery, LongScriptFieldTermsQuery, StringScriptFieldExistsQuery, StringScriptFieldPrefixQuery, StringScriptFieldRangeQuery, StringScriptFieldTermQuery, StringScriptFieldTermsQuery

public abstract class AbstractScriptFieldQuery<S extends AbstractFieldScript> extends org.apache.lucene.search.Query
Abstract base class for building queries based on script fields.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final float
    We don't have the infrastructure to estimate the match cost of a script so we just use a big number.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractScriptFieldQuery(Script script, String fieldName, Function<org.apache.lucene.index.LeafReaderContext,S> scriptContextFunction)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.lucene.search.TwoPhaseIterator
    createTwoPhaseIterator(S scriptContext, org.apache.lucene.search.DocIdSetIterator approximation)
    Creates the TwoPhaseIterator for the current leaf reader.
    org.apache.lucene.search.Weight
    createWeight(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost)
     
    boolean
     
    final String
     
    int
     
    protected abstract boolean
    matches(S scriptContext, int docId)
     
    final Script
     
    void
    visit(org.apache.lucene.search.QueryVisitor visitor)
     

    Methods inherited from class org.apache.lucene.search.Query

    classHash, rewrite, rewrite, sameClassAs, toString, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • MATCH_COST

      protected static final float MATCH_COST
      We don't have the infrastructure to estimate the match cost of a script so we just use a big number.
      See Also:
  • Constructor Details

    • AbstractScriptFieldQuery

      protected AbstractScriptFieldQuery(Script script, String fieldName, Function<org.apache.lucene.index.LeafReaderContext,S> scriptContextFunction)
  • Method Details

    • script

      public final Script script()
    • fieldName

      public final String fieldName()
    • createWeight

      public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) throws IOException
      Overrides:
      createWeight in class org.apache.lucene.search.Query
      Throws:
      IOException
    • createTwoPhaseIterator

      protected org.apache.lucene.search.TwoPhaseIterator createTwoPhaseIterator(S scriptContext, org.apache.lucene.search.DocIdSetIterator approximation)
      Creates the TwoPhaseIterator for the current leaf reader. Override to inject custom behaviour or provide additional context to the matches method when needed.
    • matches

      protected abstract boolean matches(S scriptContext, int docId)
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class org.apache.lucene.search.Query
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class org.apache.lucene.search.Query
    • visit

      public void visit(org.apache.lucene.search.QueryVisitor visitor)
      Specified by:
      visit in class org.apache.lucene.search.Query