ejsDecayScoreFunction

Decay functions score a document with a function that decays depending on the distance of a numeric field value of the document from a user given origin. This is similar to a range query, but with smooth edges instead of boxes.

Supported decay functions are: linear, exp, and gauss.

Module

 DecayScoreFunction

DecayScoreFunction ( field )

Score a document with a function that decays depending on the distance of a numeric field value of the document from given origin.


Parameters
field <String> the document field to run decay function against.

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
Objectdecay(d)Sets the decay value which defines how documents are scored at the distance given at scale.
Objectexp()Use the exp decay function. Exponential decay.
Objectfield(f)Sets the fields to run the decay function against.
Objectfilter(oFilter)Adds a filter whose matching documents will have the score function applied.
Objectgauss()Use the gauss decay function. Normal decay.
Objectlinear()Use the linear decay function. Linear decay.
Objectoffset(o)Sets the decay offset. The decay function will only compute a the decay function for documents with a distance greater that the defined offset. The default is 0.
Objectorigin(o)Sets the origin which is the “central point” from which the distance is calculated.
Objectscale(s)Sets the scale/rate of decay.
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

 decay

Object decay ( d )
Sets the decay value which defines how documents are scored at the distance given at scale.

Parameters
d <Double> A decay value as a double.
Returns
returns this so that calls can be chained.

 exp

Object exp ( )
Use the exp decay function. Exponential decay.

Returns
returns this so that calls can be chained.

 field

Object field ( f )
Sets the fields to run the decay function against.

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

 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.

 gauss

Object gauss ( )
Use the gauss decay function. Normal decay.

Returns
returns this so that calls can be chained.

 linear

Object linear ( )
Use the linear decay function. Linear decay.

Returns
returns this so that calls can be chained.

 offset

Object offset ( o )
Sets the decay offset. The decay function will only compute a the decay function for documents with a distance greater that the defined offset. The default is 0.

Parameters
o <String> A valid offset value for the field type.
Returns
returns this so that calls can be chained.

 origin

Object origin ( o )
Sets the origin which is the “central point” from which the distance is calculated.

Parameters
o <String> A valid origin value for the field type.
Returns
returns this so that calls can be chained.

 scale

Object scale ( s )
Sets the scale/rate of decay.

Parameters
s <String> A valid scale value for the field type.
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