Skip to main content

Order By

An optional ORDER BY clause can be specified to enforce the sort order of the results.

MQL supports these sort orders if the search index is a Lucene index:

  • Name [asc]: sort by name in ascending order
  • Name desc: sort by name in descending order
  • Relevance: sort by relevance, i.e. object with highest rank at the top of the results
  • "Updated Date": sort by "Updated Date" in descending order, i.e. latest first

If the search index is a Solr index, you can order your query results not only by Name, Relevance and "Updated Date" but also by other property types:

  • System attributes. Note: Only the system attributes that are stored in the search index can be used as the order by fields. Besides multi-valued system attributes such as "Data Classifications" or object-valued system attributes such as "Column Statistics" cannot be used as an order by field
  • Custom attributes. Note: Custom attributes of the Enumeration (Multi-value), Users, Rich Text, Blob, or Multiline Text type cannot be used as an order by field.
  • Profile attributes
  • Data Profiling attributes except the multi-valued attribute "Data Profiling"."Inferred Data Types"
  • UDPs

You can have more than one order by field in the Order By clause. Each field can be a property type in the above list with its own asc(ending) or desc(ending) order. For example, "Last Name" asc, "First Name" desc. This sorts everything by "Last Name" in the ascending order first and then by "First Name" in the descending order whenever the "Last Name" property for two or more objects are identical.

The objects in which a sort field is not present are placed on the bottom of the order by results regardless of the ascending or descending order.

The sort order Relevance cannot be combined with other fields.

If a text filter or semantic_search_text filter is present, the default sort order is relevance; otherwise, the default sort order is Name ascending.

The property types in the Order By clause are case-sensitive.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!