Class SpanNearQueryBuilder.SpanGapQueryBuilder

org.elasticsearch.index.query.SpanNearQueryBuilder.SpanGapQueryBuilder
All Implemented Interfaces:
NamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject, QueryBuilder, Rewriteable<QueryBuilder>, SpanQueryBuilder
Enclosing class:
SpanNearQueryBuilder

public static class SpanNearQueryBuilder.SpanGapQueryBuilder extends implements SpanQueryBuilder
SpanGapQueryBuilder enables gaps in a SpanNearQuery. Since, SpanGapQuery is private to SpanNearQuery, SpanGapQueryBuilder cannot be used to generate a Query (SpanGapQuery) like another QueryBuilder. Instead, it just identifies a span_gap clause so that SpanNearQuery.addGap(int) can be invoked for it. This QueryBuilder is only applicable as a clause in SpanGapQueryBuilder but yet to enforce this restriction.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.index.query.SpanQueryBuilder

    SpanQueryBuilder.SpanQueryBuilderUtil

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static
     

    Fields inherited from interface org.elasticsearch.index.query.Rewriteable

    MAX_REWRITE_ROUNDS

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
     fieldName, int width)
    Constructs a new SpanGapQueryBuilder term query.
    Read from a stream.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the boost for this query.
    boost​(float boost)
    Sets the boost for this query.
    boolean
     obj)
     
     
    fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser)
     
    Returns the name that identifies uniquely the query
    Returns the name of the writeable object
    int
     
    Returns the arbitrary name assigned to the query (see named queries).
     queryName)
    Sets the arbitrary name to be assigned to the query (see named queries).
    protected static void
     queryName, org.elasticsearch.common.xcontent.XContentLocation contentLocation,  processedFieldName,  currentFieldName)
     
    org.apache.lucene.search.Query
    Converts this QueryBuilder to a lucene Query.
     
    org.elasticsearch.common.xcontent.XContentBuilder
    toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
     
    int
     
    void
    Write this into the StreamOutput.

    Methods inherited from class java.lang.

    , , , , , , ,

    Methods inherited from interface org.elasticsearch.index.query.QueryBuilder

    rewrite

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject

    isFragment
  • Field Details

  • Constructor Details

    • SpanGapQueryBuilder

      public SpanGapQueryBuilder( fieldName, int width)
      Constructs a new SpanGapQueryBuilder term query.
      Parameters:
      fieldName - The name of the field
      width - The width of the gap introduced
    • SpanGapQueryBuilder

      public SpanGapQueryBuilder(StreamInput in) throws
      Read from a stream.
      Throws:
  • Method Details

    • fieldName

      public  fieldName()
      Returns:
      fieldName The name of the field
    • width

      public int width()
      Returns:
      width The width of the gap introduced
    • toQuery

      public org.apache.lucene.search.Query toQuery(SearchExecutionContext context) throws
      Description copied from interface: QueryBuilder
      Converts this QueryBuilder to a lucene Query. Returns null if this query should be ignored in the context of parent queries.
      Specified by:
      toQuery in interface QueryBuilder
      Parameters:
      context - additional information needed to construct the queries
      Returns:
      the Query or null if this query should be ignored upstream
      Throws:
    • queryName

      public  queryName()
      Description copied from interface: QueryBuilder
      Returns the arbitrary name assigned to the query (see named queries).
      Specified by:
      queryName in interface QueryBuilder
    • queryName

      public  queryName)
      Description copied from interface: QueryBuilder
      Sets the arbitrary name to be assigned to the query (see named queries). Implementers should return the concrete type of the QueryBuilder so that calls can be chained. This is done automatically when extending AbstractQueryBuilder.
      Specified by:
      queryName in interface QueryBuilder
    • boost

      public float boost()
      Description copied from interface: QueryBuilder
      Returns the boost for this query.
      Specified by:
      boost in interface QueryBuilder
    • boost

      public QueryBuilder boost(float boost)
      Description copied from interface: QueryBuilder
      Sets the boost for this query. Documents matching this query will (in addition to the normal weightings) have their score multiplied by the boost provided. Implementers should return the concrete type of the QueryBuilder so that calls can be chained. This is done automatically when extending AbstractQueryBuilder.
      Specified by:
      boost in interface QueryBuilder
    • getName

      public  getName()
      Description copied from interface: QueryBuilder
      Returns the name that identifies uniquely the query
      Specified by:
      getName in interface QueryBuilder
    • getWriteableName

      public  getWriteableName()
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
      Specified by:
      getWriteableName in interface NamedWriteable
    • writeTo

      public final void writeTo(StreamOutput out) throws
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
    • fromXContent

      public static SpanNearQueryBuilder.SpanGapQueryBuilder fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws
      Throws:
    • equals

      public final boolean equals( obj)
      Overrides:
       in class 
    • hashCode

      public final int hashCode()
      Overrides:
       in class 
    • toString

      public final  toString()
      Overrides:
       in class 
    • throwParsingExceptionOnMultipleFields

      protected static void throwParsingExceptionOnMultipleFields( queryName, org.elasticsearch.common.xcontent.XContentLocation contentLocation,  processedFieldName,  currentFieldName)