Base Query Syntax
Base Query Syntax
The query system support two major types, Strings and Numbers. When searching for objects, it will be necessary to distinguish between those two types.
Text Queries
When dealing with text types, the :
operator is used for textual equality. The full syntax is as follows:
{property name}:{property value}
This will perform a query which matches objects with the following criteria:
property name
must exist on the objectThe value of the object in the database must be a string
The value must match exactly
property value
If those conditions are not met, then no objects will match.
Additionally, it is possible to encapsulate the property in quotes to ensure that the parser will properly parse the values. For example:
displayName:"Jack Ryan 1984"
Will match exactly the string "Jack Ryan 1984"
Numeric Queries
Similar text queries, numeric queries exist allowing for complex selection of numeric values. Unlike text queries, Elements supports multiple operators:
<
- Less Than>
- Greater Than<=
- Less Than or Equal To>=
- Greater Than or Equal To=
- Equal to!=
- Not Equal or Logical Xor:
andTO
- Range Operator
Numeric queries typically look a little bit different than their string-based counterparts and, with the exception of the range operator, follow the following syntax:
{property name} {numeric operator} {property value}
This will perform a query which matches objects with the following criteria:
property name
must exist on the objectThe
numeric operator
must be a valid operator one of:<
,>
,<=
,>=
,=
,!=
For range queries, see the section Range Query for more information.
The value must match
property value
based on the rules of the operator
For example, it would be possible to find all scores greater than 100 using the following query:
score > 100
Range Query
The Range Query is a special case designed to reduce the need to define ranges using a combination of boolean operators. Range Queries look similar to String queries, with the important distinction that they are able to operate ranges of numbers. All ranges are inclusive and use the following syntax:
{property name}:{property lower bound} TO {property upper bound}
This will perform a query which matches objects with the following criteria:
property name
must exist on the objectThe value of the object in the database must be a number
The value must be ...
Greater than or equal to
property lower bound
Less than or equal to
property upper bound
Last updated