When using predefined static or dynamic keywords for queries, you can change how the Keyword Values are applied to the search by configuring operator constraints.
By default, a query made with predefined keywords returns only documents with a Keyword Value equal to the value specified. But you can use operator constraints to instead return documents with a range of Keyword Values relative to the preconfigured value. This functionality allows you to configure the query to return results greater than the predefined Keyword Value, or results between two predefined values.
To configure operator constraints for predefined keywords, objects must be added to the operatorConstraints array for each instance of the predefined keyword you want to apply a different operator to. Each of these objects must contain a keywordId key to specify the Keyword Type, an instance key to identify which iteration of the keyword the operation is applied to, and an operator key to control how the preconfigured value instance relates to the values returned by the query.
Valid values for the operator key can be expressed either as a string or an operator symbol, and include the following:
-
"LessThan" or <
-
"LessThanEqual" or <=
-
"GreaterThan" or >
-
"GreaterThanEqual" or >=
-
"Equal" or =(the default operator)
The following example shows a Municipal Contracts Custom Query (ID #103) configured to return results greater than or equal to the first predefined instance of the Total Value keyword (ID #127), and less than or equal to the second instance of the Total Value keyword:
"selectedQueryId": 103,
"keywordList": [
{
"keywordId": 127,
"value": "500"
},
{
"keywordId": 127,
"value": "10000"
}
],
"operatorConstraints": [
{
"keywordId": 127,
"instance": 1,
"operator": "GreaterThanEqual"
},
{
"keywordId": 127,
"instance": 2,
"operator": "LessThanEqual"
}
],