ejsFuzzyQuery

A fuzzy search query based on the Damerau-Levenshtein (optimal string alignment) algorithm, though you can explicitly choose classic Levenshtein by passing false to the transpositions parameter./p>

fuzzy query on a numeric field will result in a range query “around” the value using the min_similarity value. As an example, if you perform a fuzzy query against a field value of "12" with a min similarity setting of "2", the query will search for values between "10" and "14".

Module

 FuzzyQuery

FuzzyQuery ( field, value )

Constructs a query where each documents returned are “like” provided text


Parameters
field <String> The field to run the fuzzy query against.
value <String> The value to fuzzify.

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectboost(boost)

Sets the boost value of the Query.

Objectfield(f)

The field to run the query against.

ObjectmaxExpansions(max)

The maximum number of query terms that will be included in any generated query. Defaults to 50.

ObjectminSimilarity(min)

The minimum similarity of the term variants. Defaults to 0.5.

ObjectprefixLength(len)

Length of required common prefix on variant terms. Defaults to 0.

Objectrewrite(m)

Sets rewrite method. Valid values are:

constant_score_auto - tries to pick the best constant-score rewrite method based on term and document counts from the query
scoring_boolean - translates each term into boolean should and keeps the scores as computed by the query
constant_score_boolean - same as scoring_boolean, expect no scores are computed.
constant_score_filter - first creates a private Filter, by visiting each term in sequence and marking all docs for that term
top_terms_boost_N - first translates each term into boolean should and scores are only computed as the boost using the top N scoring terms. Replace N with an integer value.
top_terms_N - first translates each term into boolean should and keeps the scores as computed by the query. Only the top N scoring terms are used. Replace N with an integer value.

Default is constant_score_auto.

This is an advanced option, use with care.

StringtoJSON()Retrieves the internal query object. This is typically used by internal API functions so use with caution.
Objecttranspositions(trueFalse)

Set to false to use classic Levenshtein edit distance.

Objectvalue(s)

The query text to fuzzify.


Method Detail

 _type

String _type ( )
The type of ejs object. For internal use only.

Returns
the type of object

 boost

Object boost ( boost )

Sets the boost value of the Query.


Parameters
boost <Double> A positive double value.
Returns
returns this so that calls can be chained.

 field

Object field ( f )

The field to run the query against.


Parameters
f <String> A single field name.
Returns
returns this so that calls can be chained.

 maxExpansions

Object maxExpansions ( max )

The maximum number of query terms that will be included in any generated query. Defaults to 50.


Parameters
max <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 minSimilarity

Object minSimilarity ( min )

The minimum similarity of the term variants. Defaults to 0.5.


Parameters
min <Double> A positive double value.
Returns
returns this so that calls can be chained.

 prefixLength

Object prefixLength ( len )

Length of required common prefix on variant terms. Defaults to 0.


Parameters
len <Integer> A positive integer value.
Returns
returns this so that calls can be chained.

 rewrite

Object rewrite ( m )

Sets rewrite method. Valid values are:

constant_score_auto - tries to pick the best constant-score rewrite method based on term and document counts from the query
scoring_boolean - translates each term into boolean should and keeps the scores as computed by the query
constant_score_boolean - same as scoring_boolean, expect no scores are computed.
constant_score_filter - first creates a private Filter, by visiting each term in sequence and marking all docs for that term
top_terms_boost_N - first translates each term into boolean should and scores are only computed as the boost using the top N scoring terms. Replace N with an integer value.
top_terms_N - first translates each term into boolean should and keeps the scores as computed by the query. Only the top N scoring terms are used. Replace N with an integer value.

Default is constant_score_auto.

This is an advanced option, use with care.


Parameters
m <String> The rewrite method as a string.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )
Retrieves the internal query object. This is typically used by internal API functions so use with caution.

Returns
returns this object's internal query property.

 transpositions

Object transpositions ( trueFalse )

Set to false to use classic Levenshtein edit distance.


Parameters
trueFalse <Boolean> A boolean value
Returns
returns this so that calls can be chained.

 value

Object value ( s )

The query text to fuzzify.


Parameters
s <String> A text string.
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo