ejsScriptField

ScriptField's allow you create dynamic fields on stored documents at query time. For example, you might have a set of document thats containsthe fields price and quantity. At query time, you could define a computed property that dynamically creates a new field called totalin each document based on the calculation price * quantity.

Module

 ScriptField

ScriptField ( fieldName )

Computes dynamic document properties based on information from other fields.


Parameters
fieldName <String> A name of the script field to create.

Method Summary

Returns Name Description
String_type()The type of ejs object. For internal use only.
ObjectignoreFailure(trueFalse)If execeptions thrown from the script should be ignored or not. Default: false
Objectlang(language)The script language being used. Currently supported values are javascript and mvel.
Objectparams(oParams)Allows you to set script parameters to be used during the execution of the script.
Objectscript(expression)Sets the script/code that will be used to perform the calculation.
StringtoJSON()Retrieves the internal script 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

 ignoreFailure

Object ignoreFailure ( trueFalse )
If execeptions thrown from the script should be ignored or not. Default: false

Parameters
trueFalse <Boolean> if execptions should be ignored
Returns
returns this so that calls can be chained.

 lang

Object lang ( language )
The script language being used. Currently supported values are javascript and mvel.

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

 params

Object params ( oParams )
Allows you to set script parameters to be used during the execution of the script.

Parameters
oParams <Object> An object containing key/value pairs representing param name/value.
Returns
returns this so that calls can be chained.

 script

Object script ( expression )
Sets the script/code that will be used to perform the calculation.

Parameters
expression <String> The script/code to use.
Returns
returns this so that calls can be chained.

 toJSON

String toJSON ( )
Retrieves the internal script object. This is typically used by internal API functions so use with caution.

Returns
returns this object's internal facet property.

Request

Queries

Filters

Aggregations

Facets

Suggesters

Geo