CQL Keywords Reference

A keyword in CQL is a word or phrase that:

  • joins two or more clauses together to form a complex CQL query, or
  • alters the logic of one or more clauses, or
  • alters the logic of operators, or
  • has an explicit definition in a CQL query, or
  • performs a specific function that alters the results of a CQL query.

List of Keywords:

AND

Used to combine multiple clauses, allowing you to refine your search.

Note: you can use parentheses to control the order in which clauses are executed.

Examples
  • Find all blogposts with the label "performance"

    label = "performance" and type = "blogpost"
  • Find all pages created by jsmith in the DEV space

    type = page and creator = jsmith and space = DEV
  • Find all content that mentions jsmith but was not created by jsmith

    mention = jsmith and creator != jsmith

^top of keywords | ^^top of topic

OR

Used to combine multiple clauses, allowing you to expand your search.

Note: you can use parentheses to control the order in which clauses are executed.

(Note: also see IN, which can be a more convenient way to search for multiple values of a field.)

Examples
  • Find all content in the IDEAS space or with the label idea

    space = IDEAS or label = idea
  • Find all content last modified before the start of the year or with the label needs_review

    lastModified < startOfYear() or label = needs_review

^top of keywords | ^^top of topic

NOT

Used to negate individual clauses or a complex CQL query (a query made up of more than one clause) using parentheses, allowing you to refine your search.

(Note: also see NOT EQUALS ("!="), DOES NOT CONTAIN ("!~") and NOT IN.)

Examples
  • Find all pages with the "cql" label that aren't in the dev space

    label = cql and not space = dev 

^top of keywords | ^^top of topic

ORDER BY

Used to specify the fields by whose values the search results will be sorted.

By default, the field's own sorting order will be used. You can override this by specifying ascending order ("asc") or descending order ("desc").

Not all fields support Ordering. Generally, ordering is not supported where a piece of content can have multiple values for a field, for instance ordering is not supported on labels.

Examples
  • Find content in the DEV space ordered by creation date

    space = DEV order by created
  • Find content in the DEV space ordered by creation date with the newest first, then title

    space = DEV order by created desc, title
  • Find pages created by jsmith ordered by space, then title

    creator = jsmith order by space, title asc

^top of keywords | ^^top of topic

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport