ejsCommonTermsQuery

A query that executes high-frequency terms in a optional sub-query to prevent slow queries due to "common" terms like stopwords.

This query basically builds two queries out of the terms in the query string where low-frequency terms are added to a required boolean clause and high-frequency terms are added to an optional boolean clause. The optional clause is only executed if the required "low-frequency' clause matches.

CommonTermsQuery has several advantages over stopword filtering at index or query time since a term can be "classified" based on the actual document frequency in the index and can prevent slow queries even across domains without specialized stopword files.

Module

 CommonTermsQuery

CommonTermsQuery ( field, qstr )
A query that executes high-frequency terms in a optional sub-query.

Parameters
field <String> the document field/key 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 commoning the Query.
ObjectcutoffFrequency(freq)Sets the maximum threshold/frequency to be considered a low frequency term. Set to a value between 0 and 1.
ObjectdisableCoord(trueFalse)Enables or disables similarity coordinate scoring of documents commoning the Query. Default: false.
Objectfield(f)Sets the field to query against.
ObjecthighFreqOperator(op)Sets the boolean operator to be used for high frequency terms. Default: AND
ObjectlowFreqOperator(op)Sets the boolean operator to be used for low frequency terms. Default: AND
ObjectminimumShouldMatchHighFreq(min)Sets the minimum number of high freq matches that need to match in a document before that document is returned in the results.
ObjectminimumShouldMatchLowFreq(min)Sets the minimum number of low freq matches that need to match in a document before that document is returned in the results.
Objectquery(qstr)Sets the query string.
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 ( 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 commoning 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. Set to a value between 0 and 1.

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

 disableCoord

Object disableCoord ( trueFalse )
Enables or disables similarity coordinate scoring of documents commoning the Query. Default: false.

Parameters
trueFalse <String> A true/false
Returns
returns this so that calls can be chained.

 field

Object field ( f )
Sets the field to query against.

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

 highFreqOperator

Object highFreqOperator ( op )
Sets the boolean operator to be used for high frequency terms. Default: AND

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

 lowFreqOperator

Object lowFreqOperator ( op )
Sets the boolean operator to be used for low frequency terms. Default: AND

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

 minimumShouldMatchHighFreq

Object minimumShouldMatchHighFreq ( min )
Sets the minimum number of high freq matches that need to match in a document before that document is returned in the results.

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

 minimumShouldMatchLowFreq

Object minimumShouldMatchLowFreq ( min )
Sets the minimum number of low freq matches that need to match in a document before that document is returned in the results.

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

 query

Object query ( qstr )
Sets the query string.

Parameters
qstr <String> The query 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.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo