ejsFunctionScoreQuery

The function_score allows you to modify the score of documents that are retrieved by a query. This can be useful if, for example, a score function is computationally expensive and it is sufficient to compute the score on a filtered set of documents.

Module

 FunctionScoreQuery

FunctionScoreQuery ( )

A query that allows you to modify the score of matching documents.


Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectboost(boost)Sets the boost value for documents matching the Query.
Objectboost(boost)Sets the boost value for all documents matching the query.
ObjectboostMode(mode)Set the setermines how the new calculated score is combined with the score from the original query. Valid values are: multiply, replace, sum, avg, max, and min.
Objectfilter(oFilter)Set the source filter.
Objectfunction(func)Add a single score function to the list of existing functions.
Objectfunctions(funcs)Sets the score functions. Replaces any existing score functions.
ObjectmaxBoost(maxBoost)Sets the maximum boost value.
ObjectminScore(minScore)Sets the minimum score a document should have to be included.
Objectquery(oQuery)Set the source query.
ObjectscoreMode(mode)Set the scoring mode which specifies how the computed scores are combined. Valid values are: avg, max, min, sum, multiply, and first.
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

 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.

 boost

Object boost ( boost )
Sets the boost value for all documents matching the query.

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

 boostMode

Object boostMode ( mode )
Set the setermines how the new calculated score is combined with the score from the original query. Valid values are: multiply, replace, sum, avg, max, and min.

Parameters
mode <String> A boosting mode.
Returns
returns this so that calls can be chained.

 filter

Object filter ( oFilter )
Set the source filter.

Parameters
oFilter <Filter> A valid Filter object
Returns
returns this so that calls can be chained.

 function

Object function ( func )
Add a single score function to the list of existing functions.

Parameters
func <ScoreFunction> A valid ScoreFunction object.
Returns
returns this so that calls can be chained.

 functions

Object functions ( funcs )
Sets the score functions. Replaces any existing score functions.

Parameters
funcs <ScoreFunction[]> A array of ScoreFunctions.
Returns
returns this so that calls can be chained.

 maxBoost

Object maxBoost ( maxBoost )
Sets the maximum boost value.

Parameters
maxBoost <Float> A positive float value.
Returns
returns this so that calls can be chained.

 minScore

Object minScore ( minScore )
Sets the minimum score a document should have to be included.

Parameters
minScore <Float> A positive float value.
Returns
returns this so that calls can be chained.

 query

Object query ( oQuery )
Set the source query.

Parameters
oQuery <Query> A valid Query object
Returns
returns this so that calls can be chained.

 scoreMode

Object scoreMode ( mode )
Set the scoring mode which specifies how the computed scores are combined. Valid values are: avg, max, min, sum, multiply, and first.

Parameters
mode <String> A scoring mode.
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