Package org.elasticsearch.index.query
Class SpanNearQueryBuilder.SpanGapQueryBuilder
- java.lang.Object
-
- org.elasticsearch.index.query.SpanNearQueryBuilder.SpanGapQueryBuilder
-
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentObject,QueryBuilder,Rewriteable<QueryBuilder>,SpanQueryBuilder
- Enclosing class:
- SpanNearQueryBuilder
public static class SpanNearQueryBuilder.SpanGapQueryBuilder extends java.lang.Object 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.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, 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 java.lang.StringNAME-
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 SpanGapQueryBuilder(java.lang.String fieldName, int width)Constructs a new SpanGapQueryBuilder term query.SpanGapQueryBuilder(StreamInput in)Read from a stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description floatboost()Returns the boost for this query.QueryBuilderboost(float boost)Sets the boost for this query.booleanequals(java.lang.Object obj)java.lang.StringfieldName()static SpanNearQueryBuilder.SpanGapQueryBuilderfromXContent(XContentParser parser)java.lang.StringgetName()Returns the name that identifies uniquely the queryjava.lang.StringgetWriteableName()Returns the name of the writeable objectinthashCode()java.lang.StringqueryName()Returns the arbitrary name assigned to the query (see named queries).QueryBuilderqueryName(java.lang.String queryName)Sets the arbitrary name to be assigned to the query (see named queries).protected static voidthrowParsingExceptionOnMultipleFields(java.lang.String queryName, XContentLocation contentLocation, java.lang.String processedFieldName, java.lang.String currentFieldName)org.apache.lucene.search.QuerytoFilter(QueryShardContext context)Converts this QueryBuilder to an unscored luceneQuerythat acts as a filter.org.apache.lucene.search.QuerytoQuery(QueryShardContext context)Converts this QueryBuilder to a luceneQuery.java.lang.StringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)intwidth()voidwriteTo(StreamOutput out)Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.index.query.QueryBuilder
rewrite
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SpanGapQueryBuilder
public SpanGapQueryBuilder(java.lang.String fieldName, int width)Constructs a new SpanGapQueryBuilder term query.- Parameters:
fieldName- The name of the fieldwidth- The width of the gap introduced
-
SpanGapQueryBuilder
public SpanGapQueryBuilder(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
fieldName
public java.lang.String 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(QueryShardContext context) throws java.io.IOException
Description copied from interface:QueryBuilderConverts this QueryBuilder to a luceneQuery. Returnsnullif this query should be ignored in the context of parent queries.- Specified by:
toQueryin interfaceQueryBuilder- Parameters:
context- additional information needed to construct the queries- Returns:
- the
Queryornullif this query should be ignored upstream - Throws:
java.io.IOException
-
toFilter
public org.apache.lucene.search.Query toFilter(QueryShardContext context) throws java.io.IOException
Description copied from interface:QueryBuilderConverts this QueryBuilder to an unscored luceneQuerythat acts as a filter. Returnsnullif this query should be ignored in the context of parent queries.- Specified by:
toFilterin interfaceQueryBuilder- Parameters:
context- additional information needed to construct the queries- Returns:
- the
Queryornullif this query should be ignored upstream - Throws:
java.io.IOException
-
queryName
public java.lang.String queryName()
Description copied from interface:QueryBuilderReturns the arbitrary name assigned to the query (see named queries).- Specified by:
queryNamein interfaceQueryBuilder
-
queryName
public QueryBuilder queryName(java.lang.String queryName)
Description copied from interface:QueryBuilderSets the arbitrary name to be assigned to the query (see named queries). Implementers should return the concrete type of theQueryBuilderso that calls can be chained. This is done automatically when extendingAbstractQueryBuilder.- Specified by:
queryNamein interfaceQueryBuilder
-
boost
public float boost()
Description copied from interface:QueryBuilderReturns the boost for this query.- Specified by:
boostin interfaceQueryBuilder
-
boost
public QueryBuilder boost(float boost)
Description copied from interface:QueryBuilderSets 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 theQueryBuilderso that calls can be chained. This is done automatically when extendingAbstractQueryBuilder.- Specified by:
boostin interfaceQueryBuilder
-
getName
public java.lang.String getName()
Description copied from interface:QueryBuilderReturns the name that identifies uniquely the query- Specified by:
getNamein interfaceQueryBuilder
-
getWriteableName
public java.lang.String getWriteableName()
Description copied from interface:NamedWriteableReturns the name of the writeable object- Specified by:
getWriteableNamein interfaceNamedWriteable
-
writeTo
public final void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:WriteableWrite this into the StreamOutput.
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
fromXContent
public static SpanNearQueryBuilder.SpanGapQueryBuilder fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
throwParsingExceptionOnMultipleFields
protected static void throwParsingExceptionOnMultipleFields(java.lang.String queryName, XContentLocation contentLocation, java.lang.String processedFieldName, java.lang.String currentFieldName)
-
-