RQL is an useful search tool when you need to search through assets in a database. It is important to understand how to search for different criteria for an asset. RQL provides advanced search capabilities within Reach Engine that are similar to SQL queries.
When performing an RQL query, specify the name of the property you would like to search against. More traditional-looking upper-case SQL is supported. Both of the following syntaxes are supported:
name like 'cook'
name LIKE 'cook'
RQL Operators
Operator |
Description
|
Example
|
---|---|---|
Equals | Returns all values that exactly match the value entered. |
name = 'cook' Finds all values where name equals cook. The following results would not be returned because they are not an exact match: cook1 or Cook. |
Not Equals | Returns all values not matching the value entered. |
name != 'cook' Finds all values where name does not equal cook. |
Offset and Pagination |
Pagination is controlled with the offset and size keywords. |
name = 'cook' offset 4 size 3 Returns results in groups of 3, 4 results into the result set. |
Like |
Returns values that contain the value entered. |
name like 'ook' Performs a “contains” query on the field specified. Therefore, values such as looking and booking are returned. |
Not Like | Returns values that do not contain the value entered. |
name not like 'ook' Performs a 'does not contain' query on the field specified. |
In | Returns all results that contain the values submitted. |
myList in ('one', 'two', 'three') Performs a query where 'myList' contains values one, two, or three. |
Not In | Returns all results that do not contain the value submitted. |
myList not in ('one', 'two', 'three') Performs a query where 'myList' does not contain values one, two, or three. |
Between | Returns values between two dates, integers, or numbers. |
myDate between '2013/10/01' and '2013/10/05' |
Is Null / Not Null | Returns all fields that are blank or null. |
aField is null aField is not null |
Greater Than / Greater Than Equals | 'greater than' and 'greater than or equals' are represented with the 'gt' and 'gte' symbols. |
price gt ‘12.99' dateUpdated gte '2012-10-01’ |
Less Than / Less Than Equals | 'less than' and 'less than or equals' are represented with the 'lt' and 'lte' symbols. |
price lt 12.99 dateUpdated lte '2012-10-01' |
Sorts | Sorts by a field. Multiple sorts are allowed and are separated by a comma. |
name = 'cook' order by dateUpdated asc name = 'cook' order by dateUpdated asc, name desc |
AND / OR |
Used to group expressions. Parentheses are used to group expressions and control the order of operations. AND qualifies multiple expressions together. AND keyword has a higher precedence than or but a lower precedence than parentheses. OR qualifies when one or multiple expressions are valid. OR keyword has lower precedence than either AND or parentheses. |
(name = 'Bruce Wayne' OR systemKeywords like 'batman') AND cowled = 'true' |
Comments
0 comments
Please sign in to leave a comment.