java.lang.Object
org.elasticsearch.index.query.AbstractQueryBuilder<FuzzyQueryBuilder>
org.elasticsearch.index.query.FuzzyQueryBuilder
- All Implemented Interfaces:
- NamedWriteable,- VersionedNamedWriteable,- Writeable,- MultiTermQueryBuilder,- QueryBuilder,- Rewriteable<QueryBuilder>,- ToXContent,- ToXContentObject
public class FuzzyQueryBuilder
extends AbstractQueryBuilder<FuzzyQueryBuilder>
implements MultiTermQueryBuilder
A Query that does fuzzy matching for a specific value.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContentToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.WriteableWriteable.Reader<V>, Writeable.Writer<V>
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final FuzzinessDefault maximum edit distance.static final intDefault maximum number of terms that the fuzzy query will expand to.static final intDefault number of initial characters which will not be “fuzzified”.static final booleanDefault as to whether transpositions should be treated as a primitive edit operation, instead of classic Levenshtein algorithm.static final StringFields inherited from class org.elasticsearch.index.query.AbstractQueryBuilderboost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryNameFields inherited from interface org.elasticsearch.index.query.RewriteableMAX_REWRITE_ROUNDSFields inherited from interface org.elasticsearch.xcontent.ToXContentEMPTY_PARAMS
- 
Constructor SummaryConstructorsConstructorDescriptionFuzzyQueryBuilder(String fieldName, boolean value) Constructs a new fuzzy query.FuzzyQueryBuilder(String fieldName, double value) Constructs a new fuzzy query.FuzzyQueryBuilder(String fieldName, float value) Constructs a new fuzzy query.FuzzyQueryBuilder(String fieldName, int value) Constructs a new fuzzy query.FuzzyQueryBuilder(String fieldName, long value) Constructs a new fuzzy query.FuzzyQueryBuilder(String fieldName, Object value) Constructs a new fuzzy query.FuzzyQueryBuilder(String fieldName, String value) Constructs a new fuzzy query.Read from a stream.
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleandoEquals(FuzzyQueryBuilder other) Indicates whether some otherQueryBuilderobject of the same type is "equal to" this one.protected intprotected QueryBuilderdoRewrite(QueryRewriteContext queryRewriteContext) protected org.apache.lucene.search.QuerydoToQuery(SearchExecutionContext context) protected voiddoWriteTo(StreamOutput out) protected voiddoXContent(XContentBuilder builder, ToXContent.Params params) Get the field name for this query.static FuzzyQueryBuilderfromXContent(XContentParser parser) The minimal version of the recipient this object can be sent toReturns the name of the writeable objectintmaxExpansions(int maxExpansions) intprefixLength(int prefixLength) rewrite()booleantranspositions(boolean transpositions) value()Methods inherited from class org.elasticsearch.index.query.AbstractQueryBuilderaddValidationError, boost, boost, boostAndQueryNameToXContent, checkNegativeBoost, declareStandardFields, equals, extractInnerHitBuilders, getName, hashCode, parseInnerQueryBuilder, parseInnerQueryBuilder, printBoostAndQueryName, queryName, queryName, readQueries, requireValue, rewrite, throwParsingExceptionOnMultipleFields, toQuery, toString, toXContent, writeQueries, writeToMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.index.query.QueryBuilderboost, boost, getName, queryName, queryName, rewrite, toQueryMethods inherited from interface org.elasticsearch.xcontent.ToXContenttoXContentMethods inherited from interface org.elasticsearch.xcontent.ToXContentObjectisFragment
- 
Field Details- 
NAME- See Also:
 
- 
DEFAULT_FUZZINESSDefault maximum edit distance. Defaults to AUTO.
- 
DEFAULT_PREFIX_LENGTHpublic static final int DEFAULT_PREFIX_LENGTHDefault number of initial characters which will not be “fuzzified”. Defaults to 0.- See Also:
 
- 
DEFAULT_MAX_EXPANSIONSpublic static final int DEFAULT_MAX_EXPANSIONSDefault maximum number of terms that the fuzzy query will expand to. Defaults to 50.- See Also:
 
- 
DEFAULT_TRANSPOSITIONSpublic static final boolean DEFAULT_TRANSPOSITIONSDefault as to whether transpositions should be treated as a primitive edit operation, instead of classic Levenshtein algorithm. Defaults to true.- See Also:
 
 
- 
- 
Constructor Details- 
FuzzyQueryBuilderConstructs a new fuzzy query.- Parameters:
- fieldName- The name of the field
- value- The value of the text
 
- 
FuzzyQueryBuilderConstructs a new fuzzy query.- Parameters:
- fieldName- The name of the field
- value- The value of the text
 
- 
FuzzyQueryBuilderConstructs a new fuzzy query.- Parameters:
- fieldName- The name of the field
- value- The value of the text
 
- 
FuzzyQueryBuilderConstructs a new fuzzy query.- Parameters:
- fieldName- The name of the field
- value- The value of the text
 
- 
FuzzyQueryBuilderConstructs a new fuzzy query.- Parameters:
- fieldName- The name of the field
- value- The value of the text
 
- 
FuzzyQueryBuilderConstructs a new fuzzy query.- Parameters:
- fieldName- The name of the field
- value- The value of the text
 
- 
FuzzyQueryBuilderConstructs a new fuzzy query.- Parameters:
- fieldName- The name of the field
- value- The value of the term
 
- 
FuzzyQueryBuilderRead from a stream.- Throws:
- IOException
 
 
- 
- 
Method Details- 
doWriteTo- Specified by:
- doWriteToin class- AbstractQueryBuilder<FuzzyQueryBuilder>
- Throws:
- IOException
 
- 
fieldNameDescription copied from interface:MultiTermQueryBuilderGet the field name for this query.- Specified by:
- fieldNamein interface- MultiTermQueryBuilder
 
- 
value
- 
fuzziness
- 
fuzziness
- 
prefixLength
- 
prefixLengthpublic int prefixLength()
- 
maxExpansions
- 
maxExpansionspublic int maxExpansions()
- 
transpositions
- 
transpositionspublic boolean transpositions()
- 
rewrite
- 
rewrite
- 
doXContent- Specified by:
- doXContentin class- AbstractQueryBuilder<FuzzyQueryBuilder>
- Throws:
- IOException
 
- 
fromXContent- Throws:
- IOException
 
- 
getWriteableNameDescription copied from interface:VersionedNamedWriteableReturns the name of the writeable object- Specified by:
- getWriteableNamein interface- NamedWriteable
- Specified by:
- getWriteableNamein interface- VersionedNamedWriteable
 
- 
doRewrite- Overrides:
- doRewritein class- AbstractQueryBuilder<FuzzyQueryBuilder>
- Throws:
- IOException
 
- 
doToQueryprotected org.apache.lucene.search.Query doToQuery(SearchExecutionContext context) throws IOException - Specified by:
- doToQueryin class- AbstractQueryBuilder<FuzzyQueryBuilder>
- Throws:
- IOException
 
- 
doHashCodeprotected int doHashCode()- Specified by:
- doHashCodein class- AbstractQueryBuilder<FuzzyQueryBuilder>
 
- 
doEqualsDescription copied from class:AbstractQueryBuilderIndicates whether some otherQueryBuilderobject of the same type is "equal to" this one.- Specified by:
- doEqualsin class- AbstractQueryBuilder<FuzzyQueryBuilder>
 
- 
getMinimalSupportedVersionDescription copied from interface:VersionedNamedWriteableThe minimal version of the recipient this object can be sent to- Specified by:
- getMinimalSupportedVersionin interface- VersionedNamedWriteable
 
 
-