ejsMoreLikeThisQuery

More like this query find documents that are “like” provided text by running it against one or more fields.

Module

 MoreLikeThisQuery

MoreLikeThisQuery ( fields, likeText )

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


Parameters
fields <String | String[]> A single field or array of fields to run 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 for documents matching the Query.
ObjectboostTerms(boost)Sets the boost factor to use when boosting terms. Defaults to 1.
ObjectfailOnUnsupportedField(trueFalse)Should the Query fail when an unsupported field is specified. Defaults to true.
Objectfields(f)The fields to run the query against. If you call with a single field, it is added to the existing list of fields. If called with an array of field names, it replaces any existing values with the new array.
ObjectlikeText(s)The text to find documents like
ObjectmaxDocFreq(max)The maximum frequency in which words may still appear. Words that appear in more than this many docs will be ignored. Defaults to unbounded.
ObjectmaxQueryTerms(max)The maximum number of query terms that will be included in any generated query. Defaults to 25.
ObjectmaxWordLen(len)The maximum word length above which words will be ignored. Defaults to unbounded (0).
ObjectminDocFreq(min)The frequency at which words will be ignored which do not occur in at least this many docs. Defaults to 5.
ObjectminTermFreq(freq)The frequency below which terms will be ignored in the source doc. The default frequency is 2.
ObjectminWordLen(len)The minimum word length below which words will be ignored. Defaults to 0.
ObjectpercentTermsToMatch(percent)The percentage of terms to match on (float value). Defaults to 0.3 (30 percent).
ObjectstopWords(stopWords)An array of stop words. Any word in this set is considered “uninteresting” and ignored. Even if your Analyzer allows stopwords, you might want to tell the MoreLikeThis code to ignore them, as for the purposes of document similarity it seems reasonable to assume that “a stop word is never interesting”.
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 for documents matching the Query.

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

 boostTerms

Object boostTerms ( boost )
Sets the boost factor to use when boosting terms. Defaults to 1.

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.

 fields

Object fields ( f )
The fields to run the query against. If you call with a single field, it is added to the existing list of fields. If called with an array of field names, it replaces any existing values with the new array.

Parameters
f <String | String[]> A single field name or a list of field names.
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.

 maxDocFreq

Object maxDocFreq ( max )
The maximum frequency in which words may still appear. Words that appear in more than this many docs will be ignored. Defaults to unbounded.

Parameters
max <Integer> A positive integer value.
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.

 maxWordLen

Object maxWordLen ( len )
The maximum word length above which words will be ignored. Defaults to unbounded (0).

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

 minDocFreq

Object minDocFreq ( min )
The frequency at which words will be ignored which do not occur in at least this many docs. Defaults to 5.

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

 minTermFreq

Object minTermFreq ( freq )
The frequency below which terms will be ignored in the source doc. The default frequency is 2.

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

 minWordLen

Object minWordLen ( len )
The minimum word length below which words will be ignored. Defaults to 0.

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

 percentTermsToMatch

Object percentTermsToMatch ( percent )
The percentage of terms to match on (float value). Defaults to 0.3 (30 percent).

Parameters
percent <Double> A double value between 0 and 1.
Returns
returns this so that calls can be chained.

 stopWords

Object stopWords ( stopWords )
An array of stop words. Any word in this set is considered “uninteresting” and ignored. Even if your Analyzer allows stopwords, you might want to tell the MoreLikeThis code to ignore them, as for the purposes of document similarity it seems reasonable to assume that “a stop word is never interesting”.

Parameters
stopWords <Array> An array of string stopwords
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