weighted_sum
The weighted_sum
UDAF takes a weight, type, and type-weight mapping to produce an aggregated weight. For example, consider the following SQL snippet:
weighted_sum
function produces a final weight_d
of 12.0 (21.0 + 110.0). The UDAF is passed rows grouped by query
, doc_id
, and filters
.
query | type | doc_id | filters | typed_weight_d |
---|---|---|---|---|
iPad | click | 1 | gear | 2 |
iPad | cart | 1 | gear | 1 |
significantTerms
significantTerms
UDF allows the user to query data for significant terms within the results. This identifies terms that appear an unusually frequently in a specific result set relative to the index. It can be used to identify anomalies in data.
This UDF can be used on tokenized text and multi-value and single-value string fields.
Example:
timediff
The timediff
UDF computes the difference, in milliseconds, between to timestamps in the same row. From the session_rollup
job, the timediff
function computes the difference between the current time and the last activity in a session.
click_pos
The click_pos
UDF computes either a reciprocal rank or a raw click position (using a 0-based index) of a document in a page of results. This UDF is used to compute the mean reciprocal rank (MRR) for experiments. For example, given the following list of documents and a doc ID, the click_pos
UDF will return 2:
concat_text
The concat_text
UDF combines multivalued text fields coming from Solr into a field with a single value delimited by spaces. This UDF is useful when a field returned from Solr uses the _txt
suffix, which indicates a multivalued text field.