Expand my Community achievements bar.

SOLVED

Default sorting Criteria for Query Builder results

Avatar

Level 3

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

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
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.

View solution in original post

3 Replies

Avatar

Community Advisor

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.

Avatar

Employee Advisor

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

Avatar

Correct answer by
Community Advisor
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.