How to sort the component like in CRXDE when query customization? | Community
Skip to main content
October 16, 2015
Solved

How to sort the component like in CRXDE when query customization?

  • October 16, 2015
  • 1 reply
  • 616 views

I want to query the components and sort the result by the index which like in CRXDE.

But I got the results sorted by the "lastModified" property.

In source code, I didn't put the "orderby" property in the query map.

queryMap.put("path", pagePath); queryMap.put("type", "cq:Page"); queryMap.put("1_property", "jcr:content/cq:template"); queryMap.put("1_property.1_value", OfferUtil.OFFERS26_TEMPLATE); queryMap.put("1_property.2_value", OfferUtil.OFFERS8_TEMPLATE); queryMap.put("2_property", "jcr:content/redirectTarget"); queryMap.put("2_property.operation", JcrPropertyPredicateEvaluator.OP_NOT); queryMap.put("orderby","whichProperty"); // set to get all Offers. queryMap.put("p.offset", "0"); queryMap.put("p.limit", "0");

And I want to know which property can be filled in the map that the result can sorted by the index.

like "index", "order" etc.

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 Sham_HC

Usually you don't have a search when you want the node order and can simply use navigational access (node.getNodes()) in that case.

In Jackrabbit/CRX you can globally configure "respectDocumentOrder" [0] for the query index, which is turned off by default, since it is expensive. It would have effect on queries w/o any order by statement (and might only affect xpath & sql). There is no explicit order by document order statement at all.

[0] http://wiki.apache.org/jackrabbit/Search

1 reply

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

Usually you don't have a search when you want the node order and can simply use navigational access (node.getNodes()) in that case.

In Jackrabbit/CRX you can globally configure "respectDocumentOrder" [0] for the query index, which is turned off by default, since it is expensive. It would have effect on queries w/o any order by statement (and might only affect xpath & sql). There is no explicit order by document order statement at all.

[0] http://wiki.apache.org/jackrabbit/Search