Package org.elasticsearch.index.query
Class MatchBoolPrefixQueryBuilder
java.lang.Object
org.elasticsearch.index.query.AbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
org.elasticsearch.index.query.MatchBoolPrefixQueryBuilder
- All Implemented Interfaces:
NamedWriteable
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentObject
,QueryBuilder
,Rewriteable<QueryBuilder>
The boolean prefix query analyzes the input text and creates a boolean query containing a Term query for each term, except
for the last term, which is used to create a prefix query
-
Nested Class Summary
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 inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryName
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
-
Method Summary
Modifier and TypeMethodDescriptionanalyzer()
Get the analyzer to use, if previously set, otherwisenull
Explicitly set the analyzer to use.protected boolean
Indicates whether some otherQueryBuilder
object of the same type is "equal to" this one.protected int
protected org.apache.lucene.search.Query
doToQuery(SearchExecutionContext context)
protected void
doWriteTo(StreamOutput out)
protected void
doXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
Returns the field name used in this query.static MatchBoolPrefixQueryBuilder
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
Gets the fuzziness used when evaluated to a fuzzy query type.Sets the fuzziness used when evaluated to a fuzzy query type.Get the fuzzy_rewrite parameterfuzzyRewrite(String fuzzyRewrite)
Sets the fuzzy_rewrite parameter controlling how the fuzzy query will get rewrittenboolean
Gets the fuzzy query transposition setting.fuzzyTranspositions(boolean fuzzyTranspositions)
Sets whether transpositions are supported in fuzzy queries.Returns the name of the writeable objectint
Get the (optional) number of term expansions when using fuzzy or prefix type query.maxExpansions(int maxExpansions)
When using fuzzy or prefix type query, the number of term expansions to use.Gets the minimumShouldMatch valueminimumShouldMatch(String minimumShouldMatch)
Sets optional minimumShouldMatch value to apply to the queryoperator()
Returns the operator to use in a boolean query.Sets the operator to use when using a boolean query.int
Gets the length of a length of common (non-fuzzy) prefix for fuzzy match queriesprefixLength(int prefixLength)
Sets the length of a length of common (non-fuzzy) prefix for fuzzy match queriesvalue()
Returns the value used in this query.Methods inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
addValidationError, boost, boost, checkNegativeBoost, declareStandardFields, doRewrite, equals, extractInnerHitBuilders, getName, hashCode, parseInnerQueryBuilder, parseInnerQueryBuilder, printBoostAndQueryName, queryName, queryName, requireValue, rewrite, throwParsingExceptionOnMultipleFields, toQuery, toString, toXContent, writeTo
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
-
Constructor Details
-
MatchBoolPrefixQueryBuilder
-
MatchBoolPrefixQueryBuilder
- Throws:
IOException
-
-
Method Details
-
doWriteTo
- Specified by:
doWriteTo
in classAbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
- Throws:
IOException
-
fieldName
Returns the field name used in this query. -
value
Returns the value used in this query. -
analyzer
Get the analyzer to use, if previously set, otherwisenull
-
analyzer
Explicitly set the analyzer to use. Defaults to use explicit mapping config for the field, or, if not set, the default search analyzer. -
operator
Sets the operator to use when using a boolean query. Defaults toOR
. -
operator
Returns the operator to use in a boolean query. -
minimumShouldMatch
Sets optional minimumShouldMatch value to apply to the query -
minimumShouldMatch
Gets the minimumShouldMatch value -
fuzziness
Sets the fuzziness used when evaluated to a fuzzy query type. Defaults to "AUTO". -
fuzziness
Gets the fuzziness used when evaluated to a fuzzy query type. -
prefixLength
Sets the length of a length of common (non-fuzzy) prefix for fuzzy match queries- Parameters:
prefixLength
- non-negative length of prefix- Throws:
IllegalArgumentException
- in case the prefix is negative
-
prefixLength
public int prefixLength()Gets the length of a length of common (non-fuzzy) prefix for fuzzy match queries -
maxExpansions
When using fuzzy or prefix type query, the number of term expansions to use. -
maxExpansions
public int maxExpansions()Get the (optional) number of term expansions when using fuzzy or prefix type query. -
fuzzyTranspositions
Sets whether transpositions are supported in fuzzy queries.The default metric used by fuzzy queries to determine a match is the Damerau-Levenshtein distance formula which supports transpositions. Setting transposition to false will switch to classic Levenshtein distance.
If not set, Damerau-Levenshtein distance metric will be used. -
fuzzyTranspositions
public boolean fuzzyTranspositions()Gets the fuzzy query transposition setting. -
fuzzyRewrite
Sets the fuzzy_rewrite parameter controlling how the fuzzy query will get rewritten -
fuzzyRewrite
Get the fuzzy_rewrite parameter- See Also:
fuzzyRewrite(String)
-
doXContent
protected void doXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
doXContent
in classAbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
- Throws:
IOException
-
fromXContent
public static MatchBoolPrefixQueryBuilder fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
doToQuery
protected org.apache.lucene.search.Query doToQuery(SearchExecutionContext context) throws IOException- Specified by:
doToQuery
in classAbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
- Throws:
IOException
-
doEquals
Description copied from class:AbstractQueryBuilder
Indicates whether some otherQueryBuilder
object of the same type is "equal to" this one.- Specified by:
doEquals
in classAbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
-
doHashCode
protected int doHashCode()- Specified by:
doHashCode
in classAbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
-
getWriteableName
Description copied from interface:NamedWriteable
Returns the name of the writeable object
-