Module org.elasticsearch.server
Package org.elasticsearch.index.query
Class SpanNearQueryBuilder.SpanGapQueryBuilder
java.lang.Object
org.elasticsearch.index.query.SpanNearQueryBuilder.SpanGapQueryBuilder
- All Implemented Interfaces:
NamedWriteable
,VersionedNamedWriteable
,Writeable
,QueryBuilder
,Rewriteable<QueryBuilder>
,SpanQueryBuilder
,ToXContent
,ToXContentObject
- Enclosing class:
- SpanNearQueryBuilder
public static class SpanNearQueryBuilder.SpanGapQueryBuilder
extends 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.index.query.SpanQueryBuilder
SpanQueryBuilder.SpanQueryBuilderUtil
Nested classes/interfaces inherited from interface org.elasticsearch.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
FieldsFields inherited from interface org.elasticsearch.index.query.Rewriteable
MAX_REWRITE_ROUNDS
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorsConstructorDescriptionSpanGapQueryBuilder
(String fieldName, int width) Constructs a new SpanGapQueryBuilder term query.Read from a stream. -
Method Summary
Modifier and TypeMethodDescriptionfloat
boost()
Returns the boost for this query.boost
(float boost) Sets the boost for this query.final boolean
fromXContent
(XContentParser parser) The minimal version of the recipient this object can be sent togetName()
Returns the name that identifies uniquely the queryReturns the name of the writeable objectfinal int
hashCode()
Returns the arbitrary name assigned to the query (see named queries).Sets the arbitrary name to be assigned to the query (see named queries).protected static void
throwParsingExceptionOnMultipleFields
(String queryName, XContentLocation contentLocation, String processedFieldName, String currentFieldName) org.apache.lucene.search.Query
toQuery
(SearchExecutionContext context) Converts this QueryBuilder to a luceneQuery
.final String
toString()
toXContent
(XContentBuilder builder, ToXContent.Params params) int
width()
final void
writeTo
(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.xcontent.ToXContentObject
isFragment
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
SpanGapQueryBuilder
Constructs a new SpanGapQueryBuilder term query.- Parameters:
fieldName
- The name of the fieldwidth
- The width of the gap introduced
-
SpanGapQueryBuilder
Read from a stream.- Throws:
IOException
-
-
Method Details
-
fieldName
- Returns:
- fieldName The name of the field
-
width
public int width()- Returns:
- width The width of the gap introduced
-
toQuery
Description copied from interface:QueryBuilder
Converts this QueryBuilder to a luceneQuery
. Returnsnull
if this query should be ignored in the context of parent queries.- Specified by:
toQuery
in interfaceQueryBuilder
- Parameters:
context
- additional information needed to construct the queries- Returns:
- the
Query
ornull
if this query should be ignored upstream - Throws:
IOException
-
queryName
Description copied from interface:QueryBuilder
Returns the arbitrary name assigned to the query (see named queries).- Specified by:
queryName
in interfaceQueryBuilder
-
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 theQueryBuilder
so that calls can be chained. This is done automatically when extendingAbstractQueryBuilder
.- Specified by:
queryName
in interfaceQueryBuilder
-
boost
public float boost()Description copied from interface:QueryBuilder
Returns the boost for this query.- Specified by:
boost
in interfaceQueryBuilder
-
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 theQueryBuilder
so that calls can be chained. This is done automatically when extendingAbstractQueryBuilder
.- Specified by:
boost
in interfaceQueryBuilder
-
getName
Description copied from interface:QueryBuilder
Returns the name that identifies uniquely the query- Specified by:
getName
in interfaceQueryBuilder
-
getWriteableName
Description copied from interface:VersionedNamedWriteable
Returns the name of the writeable object- Specified by:
getWriteableName
in interfaceNamedWriteable
- Specified by:
getWriteableName
in interfaceVersionedNamedWriteable
-
getMinimalSupportedVersion
Description copied from interface:VersionedNamedWriteable
The minimal version of the recipient this object can be sent to- Specified by:
getMinimalSupportedVersion
in interfaceVersionedNamedWriteable
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-
fromXContent
public static SpanNearQueryBuilder.SpanGapQueryBuilder fromXContent(XContentParser parser) throws IOException - Throws:
IOException
-
equals
-
hashCode
public final int hashCode() -
toString
-
throwParsingExceptionOnMultipleFields
protected static void throwParsingExceptionOnMultipleFields(String queryName, XContentLocation contentLocation, String processedFieldName, String currentFieldName)
-