Configuration : Configuring Search Results : Calculating Results On-The-Fly with Virtual Fields
 
Calculating Results On-The-Fly with Virtual Fields
 
When to Use Virtual Fields
Performance Considerations
Virtual Field Syntax
Virtual fields allow you to compute values from many elements of the Exalead CloudView index. The main purpose of a virtual field is to access stored index fields.
For example, a virtual field called revenue with expression price * quantity accesses the two fields and calculate the total price.
When to Use Virtual Fields
You can use virtual fields for multiple areas within your search application. For example, for a given hit, virtual fields can calculate:
A meta to display in the search client.
The value for the hit in a dynamic numerical facet (see below).
The value for the hit in a facet aggregation (see below).
Ranking elements (see below).
A value to use for filtering queries.
For example, you can define a numerical prefix handler, total_price, allowing a user to queries directly on the total price, such as. total_price: > 500.
Performance Considerations
Virtual fields have a significant overhead at query time, because of the evaluation that must take place for each hit.
In some cases, this evaluation must absolutely be performed at query time.
For example, if your geographic expression calculates the distance between a hit and the current position of the user, then it is fully contextual to the query. However, if you find yourself using a large number of virtual fields with totally static expressions that are always used, it can be a good compromise to precompute them using processors in the analysis pipeline.
Virtual Field Syntax
The virtual fields syntax supports a wide range of built-in functions:
All numerical operators
Basic math functions
Time manipulation functions
Geographic manipulation functions; for more information, see Configuring Geographic Search.
For a complete list of virtual field syntax, see Appendix - Virtual Field Expression Syntax.