Default sorting Criteria for Query Builder results | Community
Skip to main content
New Participant
April 28, 2023
Solved

Default sorting Criteria for Query Builder results

  • April 28, 2023
  • 3 replies
  • 1846 views

Hi All,

 

We have a query like this:

 

path=/content/we-retail

type=cq:Page

fulltext=Men

p.limit=-1

 

Is there any default algorithm for sorting the results when no orderby is specified.

 

From the output results we are not able to find any sort criteria.

 

Any help is appreciated.

 

Thanks

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AsifChowdhury
Hello @sb2512 

If you don't provide an orderby the parameter in your AEM Query Builder query, the search results will be sorted by the default ordering, which is usually by the node's jcr:score or _score property, depending on the version of AEM you're using and the indexing configuration.

However, the default sorting order is not always guaranteed and may depend on various factors, such as the search query complexity, the indexing configuration, and the version of AEM you're using. Therefore, it's a good practice to explicitly specify the sorting order in your query using the orderby parameter, to ensure consistent and predictable search results.

The default sorting order for fulltext search in AEM Query Builder is by relevance, as determined by the score

The "jcr:score" property is a built-in property of the Java Content Repository (JCR) specification, which is the underlying technology used by CRX. This property is automatically calculated by CRX during fulltext searches and is used to determine the relevance of the search results.

3 replies

AsifChowdhury
AsifChowdhuryAccepted solution
New Participant
April 28, 2023
Hello @sb2512 

If you don't provide an orderby the parameter in your AEM Query Builder query, the search results will be sorted by the default ordering, which is usually by the node's jcr:score or _score property, depending on the version of AEM you're using and the indexing configuration.

However, the default sorting order is not always guaranteed and may depend on various factors, such as the search query complexity, the indexing configuration, and the version of AEM you're using. Therefore, it's a good practice to explicitly specify the sorting order in your query using the orderby parameter, to ensure consistent and predictable search results.

The default sorting order for fulltext search in AEM Query Builder is by relevance, as determined by the score

The "jcr:score" property is a built-in property of the Java Content Repository (JCR) specification, which is the underlying technology used by CRX. This property is automatically calculated by CRX during fulltext searches and is used to determine the relevance of the search results.
milind_bachani
Employee
April 28, 2023

hi @sb2512 ,

 

The index of returned result of the query will differ from instance to instance as it is based on Lucene scores.

 

Also refer post for reference.

Best Regards,

Milind

Sady_Rifat
New Participant
April 28, 2023

As far as I know, orderby parameter is specified in full-text search query, which means the order in which the search results are returned is not guaranteed to be consistent or predictable.

It may We can see the same results every time because the AEM search engine is returning the results in the same order each time, based on some internal mechanism by this is not reliable. If we need to ensure a specific order of search results, we should always specify an orderby parameter in query.

I never found any article or documentation that says about the default orderby. It could be my limitation.