Package org.opensearch.index.query
Class MatchBoolPrefixQueryBuilder
java.lang.Object
org.opensearch.index.query.AbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
org.opensearch.index.query.MatchBoolPrefixQueryBuilder
- All Implemented Interfaces:
org.opensearch.core.common.io.stream.NamedWriteable
,org.opensearch.core.common.io.stream.Writeable
,org.opensearch.core.xcontent.ToXContent
,org.opensearch.core.xcontent.ToXContentObject
,QueryBuilder
,Rewriteable<QueryBuilder>
,WithFieldName
public class MatchBoolPrefixQueryBuilder
extends AbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
implements WithFieldName
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
- Opensearch.internal:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V>
-
Field Summary
Fields inherited from class org.opensearch.index.query.AbstractQueryBuilder
boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryName
Fields inherited from interface org.opensearch.index.query.Rewriteable
MAX_REWRITE_ROUNDS
Fields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionMatchBoolPrefixQueryBuilder
(String fieldName, Object value) MatchBoolPrefixQueryBuilder
(org.opensearch.core.common.io.stream.StreamInput in) -
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
(QueryShardContext context) protected void
doWriteTo
(org.opensearch.core.common.io.stream.StreamOutput out) protected void
doXContent
(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) Returns the field name used in this query.static MatchBoolPrefixQueryBuilder
fromXContent
(org.opensearch.core.xcontent.XContentParser parser) Gets the fuzziness used when evaluated to a fuzzy query type.Deprecated.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.int
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.opensearch.index.query.AbstractQueryBuilder
addValidationError, boost, boost, checkNegativeBoost, declareStandardFields, doRewrite, equals, extractInnerHitBuilders, getName, hashCode, 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.opensearch.index.query.QueryBuilder
visit
Methods inherited from interface org.opensearch.core.xcontent.ToXContentObject
isFragment
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
MatchBoolPrefixQueryBuilder
-
MatchBoolPrefixQueryBuilder
public MatchBoolPrefixQueryBuilder(org.opensearch.core.common.io.stream.StreamInput in) throws IOException - Throws:
IOException
-
-
Method Details
-
doWriteTo
- Specified by:
doWriteTo
in classAbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
- Throws:
IOException
-
fieldName
Returns the field name used in this query.- Specified by:
fieldName
in interfaceWithFieldName
-
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
Deprecated. -
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:
-
doXContent
protected void doXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
doXContent
in classAbstractQueryBuilder<MatchBoolPrefixQueryBuilder>
- Throws:
IOException
-
fromXContent
public static MatchBoolPrefixQueryBuilder fromXContent(org.opensearch.core.xcontent.XContentParser parser) throws IOException - Throws:
IOException
-
doToQuery
- 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
- Specified by:
getWriteableName
in interfaceorg.opensearch.core.common.io.stream.NamedWriteable
-