ejsFuzzyLikeThisFieldQuery

The fuzzy_like_this_field query is the same as the fuzzy_like_this query, except that it runs against a single field. It provides nicer query DSL over the generic fuzzy_like_this query, and support typed fields query (automatically wraps typed fields with type filter to match only on the specific type).

Fuzzifies ALL terms provided as strings and then picks the best n differentiating terms. In effect this mixes the behaviour of FuzzyQuery and MoreLikeThis but with special consideration of fuzzy scoring factors. This generally produces good results for queries where users may provide details in a number of fields and have no knowledge of boolean query syntax and also want a degree of fuzzy matching and a fast query.

For each source term the fuzzy variants are held in a BooleanQuery with no coord factor (because we are not looking for matches on multiple variants in any one doc). Additionally, a specialized TermQuery is used for variants and does not use that variant term’s IDF because this would favour rarer terms eg misspellings. Instead, all variants use the same IDF ranking (the one for the source query term) and this is factored into the variant’s boost. If the source query term does not exist in the index the average IDF of the variants is used.

Module

 FuzzyLikeThisFieldQuery

FuzzyLikeThisFieldQuery ( field, likeText )

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


Parameters
field <String> The field to run the query against.
likeText <String> The text to find documents like it.

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectanalyzer(analyzerName)The analyzer that will be used to analyze the text. Defaults to the analyzer associated with the field.
Objectboost(boost)Sets the boost value of the Query.
ObjectfailOnUnsupportedField(trueFalse)Should the Query fail when an unsupported field is specified. Defaults to true.
Objectfield(f)The field to run the query against.
ObjectignoreTf(trueFalse)Should term frequency be ignored. Defaults to false.
ObjectlikeText(s)The text to find documents like
ObjectmaxQueryTerms(max)The maximum number of query terms that will be included in any generated query. Defaults to 25.
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..
StringtoJSON()Retrieves the internal query object. This is typically used by internal API functions so use with caution.

Method Detail

 _type

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

Returns
the type of object

 analyzer

Object analyzer ( analyzerName )
The analyzer that will be used to analyze the text. Defaults to the analyzer associated with the field.

Parameters
analyzerName <String> The name of the analyzer.
Returns
returns this so that calls can be chained.

 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.

 failOnUnsupportedField

Object failOnUnsupportedField ( trueFalse )
Should the Query fail when an unsupported field is specified. Defaults to true.

Parameters
trueFalse <Boolean> A boolean 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.

 ignoreTf

Object ignoreTf ( trueFalse )
Should term frequency be ignored. Defaults to false.

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

 likeText

Object likeText ( s )
The text to find documents like

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

 maxQueryTerms

Object maxQueryTerms ( max )
The maximum number of query terms that will be included in any generated query. Defaults to 25.

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.

 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.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo