ejsMatchQuery

A MatchQuery is a type of Query that accepts text/numerics/dates, analyzes it, generates a query based on the MatchQuery type.

Module

 MatchQuery

MatchQuery ( field, qstr )
A Query that appects text, analyzes it, generates internal query based on the MatchQuery type.

Parameters
field <String> the document field/field to query against
qstr <String> the query string

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectanalyzer(analyzer)Sets the analyzer name used to analyze the Query object.
Objectboost(boost)Sets the boost value for documents matching the Query.
ObjectcutoffFrequency(freq)Sets the maximum threshold/frequency to be considered a low frequency term in a CommonTermsQuery. Set to a value between 0 and 1.
Objectfuzziness(fuzz)Sets the fuzziness value for the Query.
ObjectfuzzyRewrite(m)Sets fuzzy 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.
ObjectfuzzyTranspositions(trueFalse)Set to false to use classic Levenshtein edit distance in the fuzzy query.
Objectlenient(trueFalse)Enables lenient parsing of the query string.
ObjectmaxExpansions(e)Sets the max expansions of a fuzzy MatchQuery.
ObjectminimumShouldMatch(minMatch)Sets a string value controlling how many "should" clauses in the resulting Query should match.
ObjectminimumShouldMatch(minMatch)Sets a percent value controlling how many "should" clauses in the resulting Query should match.
Objectoperator(op)Sets default operator of the Query. Default: or.
ObjectprefixLength(l)Sets the prefix length for a fuzzy prefix MatchQuery.
Objectquery(qstr)Sets the query string for the Query.
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.
Objectslop(slop)Sets the default slop for phrases. If zero, then exact phrase matches are required. Default: 0.
StringtoJSON()Retrieves the internal query object. This is typically used by internal API functions so use with caution.
Objecttype(type)Sets the type of the MatchQuery. Valid values are boolean, phrase, and phrase_prefix.
ObjectzeroTermsQuery(q)Sets what happens when no terms match. Valid values are "all" or "none".

Method Detail

 _type

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

Returns
the type of object

 analyzer

Object analyzer ( analyzer )
Sets the analyzer name used to analyze the Query object.

Parameters
analyzer <String> A valid analyzer name.
Returns
returns this so that calls can be chained.

 boost

Object boost ( boost )
Sets the boost value for documents matching the Query.

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

 cutoffFrequency

Object cutoffFrequency ( freq )
Sets the maximum threshold/frequency to be considered a low frequency term in a CommonTermsQuery. Set to a value between 0 and 1.

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

 fuzziness

Object fuzziness ( fuzz )
Sets the fuzziness value for the Query.

Parameters
fuzz <Double> A double value between 0.0 and 1.0.
Returns
returns this so that calls can be chained.

 fuzzyRewrite

Object fuzzyRewrite ( m )
Sets fuzzy 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.

 fuzzyTranspositions

Object fuzzyTranspositions ( trueFalse )
Set to false to use classic Levenshtein edit distance in the fuzzy query.

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

 lenient

Object lenient ( trueFalse )
Enables lenient parsing of the query string.

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

 maxExpansions

Object maxExpansions ( e )
Sets the max expansions of a fuzzy MatchQuery.

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

 minimumShouldMatch

Object minimumShouldMatch ( minMatch )
Sets a string value controlling how many "should" clauses in the resulting Query should match.

Parameters
minMatch <String> A min should match parameter.
Returns
returns this so that calls can be chained.

 minimumShouldMatch

Object minimumShouldMatch ( minMatch )
Sets a percent value controlling how many "should" clauses in the resulting Query should match.

Parameters
minMatch <String> A min should match parameter.
Returns
returns this so that calls can be chained.

 operator

Object operator ( op )
Sets default operator of the Query. Default: or.

Parameters
op <String> Any of "and" or "or", no quote characters.
Returns
returns this so that calls can be chained.

 prefixLength

Object prefixLength ( l )
Sets the prefix length for a fuzzy prefix MatchQuery.

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

 query

Object query ( qstr )
Sets the query string for the Query.

Parameters
qstr <String> The query string to search for.
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.

 slop

Object slop ( slop )
Sets the default slop for phrases. If zero, then exact phrase matches are required. Default: 0.

Parameters
slop <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.

 type

Object type ( type )
Sets the type of the MatchQuery. Valid values are boolean, phrase, and phrase_prefix.

Parameters
type <String> Any of boolean, phrase, phrase_prefix.
Returns
returns this so that calls can be chained.

 zeroTermsQuery

Object zeroTermsQuery ( q )
Sets what happens when no terms match. Valid values are "all" or "none".

Parameters
q <String> A no match action, "all" or "none".
Returns
returns this so that calls can be chained.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo