Skip to main content
Version: Any 26

Qualification

The qualification is the part after the WHERE clause and is made of qualifiers, logical operators and parentheses.

… where (core.primary_format_extension='pdf' or standard.status='Approved')
and standard.subject like '*installation'
and core.primary_format_size>1000

Logical operators​

GQL only supports the AND, OR and NOT operators.

… (core.primary_format_extension='pdf' or standard.status='Approved')
and standard.subject like '*installation'
and not core.version_tags='Expired'

You can combine and explicitly group conditions using parentheses. The conditions between parentheses are considered a single condition.

… (core.primary_format_extension='pdf' or standard.status='Approved')
and (standard.subject like '*installation' or core.version_tags='Expired')

Predicates​

The following predicates are supported in the conditions:

PredicateCondition
<metadata> = '<text>'
<metadata> = <boolean>
<metadata> = <number>
<metadata> = <date>
The metadata is equal to the value
<metadata> <> '<text>'
<metadata> <> <number>
<metadata> <> <date>
The metadata is not equal to the value
<metadata> > <number>
<metadata> > <date>
The metadata is greater than the value
<metadata> >= <number>
<metadata> >= <date>
The metadata is greater than or equal to the value
<metadata> < <number>
<metadata> < <date>
The metadata is less than the value
<metadata> <= <number>
<metadata> <= <date>
The metadata is less than or equal to the value
<metadata> like '<text>'The metadata string is like another string. The supported wildcards are *, which matches any sequence of characters (including the empty sequence) and ?, which matches any single character. For instance: standard.title like '*quer?' matches the title single query but not all queries
<metadata> @@ '<regular expression>'The metadata value matches the regular expression, which must cover the whole value. See Regular expressions. For instance: standard.title @@ 'Report .*'
<metadata> in (value1, value2)The metadata is equal to at least one value in the list. The value can be a string or a number. For instance: standard.status in ('Published','Approved')
<metadata> not in (value1, value2)The metadata is not equal to any value in the list. The value can be a string or a number. For instance: standard.status not in ('Draft','Obsolete')
<metadata> is nullThe metadata string does not exist or is empty. For instance: custom.my_field is null
<metadata> is not nullThe metadata string exists and is not empty. For instance: custom.my_field is not null

Regular expressions​

The @@ operator compares a metadata to a regular expression, whereas like is limited to the * and ? wildcards.

  • The expression must match the whole value of the metadata, not just a part of it. To find the values that start with Report, write Report.*: Report alone only matches the exact value "Report".
  • The comparison is case-sensitive, unlike like.
  • On a multi-valued metadata, the document is kept as soon as a single one of its values matches.
  • The expression is written between single quotes, like any GQL text. An apostrophe inside it is doubled ('').

Common syntax elements:

ElementMatches
.Any single character
.*Any sequence of characters, including the empty one
[0-9]One character from the given range
(a|b)a or b
x?, x+Optional x; x repeated one or more times. Unlike like, ? does not stand for any single character
x{3}x repeated exactly three times

Examples​

Titles that start with "Report" followed by a space:

standard.title @@ 'Report .*'

Titles that end with 2025 or 2026:

standard.title @@ '.*(2025|2026)'

Documents that have at least one keyword starting with finance or legal:

standard.keywords @@ '(finance|legal).*'

Data type​

Text​

The text value must be wrapped with single quotes:

core.version_tags='Expired'

Boolean​

The boolean value (true or false) needs no quotes:

extended.is_confidential=true

Integer​

The integer value needs no quotes:

custom.my_integer > 3

Float​

Any number with a dot ('.') is considered a float:

custom.my_float > 3.5

Date​

The date value is represented by a function expression {d 'yyyy-mm-dd'}:

core.creation_date > {d '2017-02-20'}

Special functions​

Date difference​

For date comparison, you can use the special function _datediff(). This function returns the number of units between a start date and an end date (or the present moment if the end date is not specified). The result is 0 if the rounded dates are identical, it is positive if the start date is before the end date, and negative if the start date is after the end date.

select * from documents where _datediff(core.creation_date,y)<=3

The unit is used to round the value down and to specify the quantity you want to count. The supported units are the following:

  • d: round down to the day and count the number of days.
  • w: round down to the week and count the number of weeks.
  • M: round down to the month and count the number of months.
  • y: round down to the year and count the number of years.
  • H / h: round down to the hour and count the number of hours.
  • m: round down to the minute and count the number of minutes.
  • s: round down to the second and count the number of seconds.
select * from documents where _datediff(core.creation_date,y)<=3
select * from documents where _datediff(core.creation_date,M)<=48
FieldCondition
_datediff(metadata,unit)Number of units from the date specified in a metadata until now. For instance: - Contents created 3 years ago and before: _datediff(core.creation_date,y) >= 3 - Content expired for 2 months or more: _datediff(extended.expiration_date,M) >= 2 - Content expiring in 2 weeks or more: _datediff(extended.expiration_date,w) <= -2 - Contents created this year: _datediff(core.creation_date,y) = 0
_datediff(metadata,'date expression',unit)Number of units between a date specified in a metadata and a date specified as a date expression. The date expression must be defined in the ISO 8601 format (e.g. yyyy-mm-dd). The ${TODAY} wildcard is also supported. For instance: - Contents created in February 2019: _datediff(core.creation_date,'2019-02-01',M) = 0 - Content expiring after May 15, 2020: _datediff(extended.expiration_date,'2020-05-15') < 0 - Content expiring before May 15, 2020: _datediff(extended.expiration_date,'2020-05-15') > 0

Special fields​

Besides the content metadata, GQL offers internal computed fields used to filter other criteria.

Location​

The location fields start with _location and can be used to filter or exclude the contents of a specific room.

FieldCondition
_location.roomReferences the ID of the room where the contents are. Can be used with the = or <> operators. For instance: _location.room='room01'
_location.room.link_date('room ID')References the link date of the contents to the room. Can be used with date operators. For instance: _location.room.link_date('room01') > {d '2017-01-02'}

Fulltext​

The fulltext fields start with _fulltext and can be used to filter or exclude contents based on the internal full-text data.

FieldCondition
_fulltext.is_indexedSays whether the content has been full-text indexed. Can be used with the = or <> operator. For instance: _fulltext.is_indexed=true
_fulltext.failuresReferences the number of failures that happened during the full-text indexing of the content. Can be used with number comparators. For instance: _fulltext.failures>2