1. Function Queries
function queries enable you to generate an associated score (score) using the actual values of one or more numeric fields, function queries support Dixmax,edismax, and standard query parsing.
function queries use functions that can be constants (numeric or character literals), one field, another function, and a parameter that replaces parameters. You can also use this function to modify the result ordering.
Here are three main ways to query a function:
- Use the _val_ keyword to introduce a function query:
_val_:mynumericfield _val_: "Recip (Rord (MyField),
- Use parameters with explicit function query types, such as the BF (boost function) parameter of the Dismax query parser. Note The BF parameter actually uses a space-delimited list of function queries.
Q=dismax&bf= "ord (popularity) ^0.5 Recip (Rord (Price), 1,1000,1000) ^0.3"
- Add the result of a function query as a field for a document:
&fl=sum (x, y), Id,a,b,c,score
Output Result:
...<Strname= "id">Foo</Str><floatname= "sum (x, y)">40</float><floatname= "Score">0.343</float>...
Only the random quick access feature is recommended for use.
1.1 ABS
Description: Returns the absolute value of the specified values or functions
Syntax Examples: ABS (x) ABS (-5)
1.2 and
Description: Returns True when and only if two of its operations are true
Syntax examples: and ("Blue", "Sky")
1.3 constant
Description: Specifies a floating-point value constant
Syntax Examples: 1.5 or _val_:1.5
1.4 Def
Description: Default abbreviation. Returns the value of the field, returns the specified value if the field does not exist, and generates the first value where exists () ==true.
Syntax examples: def (rating,5), Def (MyField, 1.0) equivalent to if (exists (MyField) myfield,1.0)
1.5 div
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.4 Def
Describe:
Syntax Examples:
1.7.4.1 Function Queries