ejsScriptScoreFunction

The script_score function allows you to wrap another query and customize the scoring of it optionally with a computation derived from other numeric field values in the doc using a script expression.

Module

 ScriptScoreFunction

ScriptScoreFunction ( )

Modify a documents score using a script.


Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectfilter(oFilter)Adds a filter whose matching documents will have the score function applied.
Objectlang(language)The script language being used.
Objectparams(p)Sets parameters that will be applied to the script. Overwrites any existing params.
Objectscript(scriptCode)Set the script that will modify the score.
ObjectscriptId(scriptId)Set the script id that will modify the score.
StringtoJSON()

Retrieves the internal agg 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

 filter

Object filter ( oFilter )
Adds a filter whose matching documents will have the score function applied.

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

 lang

Object lang ( language )
The script language being used.

Parameters
language <String> The language of the script.
Returns
returns this so that calls can be chained.

 params

Object params ( p )
Sets parameters that will be applied to the script. Overwrites any existing params.

Parameters
p <Object> An object where the keys are the parameter name and values are the parameter value.
Returns
returns this so that calls can be chained.

 script

Object script ( scriptCode )
Set the script that will modify the score.

Parameters
scriptCode <String> A valid script string to execute.
Returns
returns this so that calls can be chained.

 scriptId

Object scriptId ( scriptId )
Set the script id that will modify the score.

Parameters
scriptId <String> Id of an indexed script.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )

Retrieves the internal agg object. This is typically used by internal API functions so use with caution.


Returns
returns this object's internal object.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo