Hi,
is it possible to order pages in a certain way through site admin and then when we do an xpath search retain the order we defined through siteadmin for results we find through xpath search.
Thanks
Chris
Solved! Go to Solution.
Views
Replies
Total Likes
Usually you don't have a search when you want the node order and can simply use navigational access (node.getNodes()) in that case. Example at [1] and then in logic you can apply filter.
In Jackrabbit/CRX you can globally configure "respectDocumentOrder" 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.
[1]
<%
Resource r = slingRequest.getResourceResolver().getResource( "/content/geometrixx/en");
Node rootNode = r.adaptTo(Node.class);
NodeIterator it = rootNode.getNodes();
while(it.hasNext()){
Node node = it.nextNode();
%>
<%=node.getName()%>
<%
}
%>
Views
Replies
Total Likes
Can you please provide more details on what you want to do. You want to use SiteAdmin to order pages?
Views
Replies
Total Likes
I want to use siteadmin to order pages in a certain way eg
page1 - has a property called foods
page3 - has a property called games
page4 - has a property called drinks
page9 - has a property called games
page10 - - has a property called foods
I would like to now write a servlet to search for foods and games
I would like the order to be retained as
page1 - has a property called foods
page3 - has a property called games
page9 - has a property called games
page10 - - has a property called foods
Views
Replies
Total Likes
Your requirement does not look like sorting. It is about filtering. You can meet it using [1] & might be additional filtering.
[1] http://dev.day.com/docs/en/cq/current/developing/customize_siteadmin.html
Views
Replies
Total Likes
what I want to do is use querymanager to select from a particular path and get all the pages in that.
However I want the result to retain the node ordering you see inside jcr
eg
news page
--> news page 3
--> news page 1
--> news page 3
when I run my query using querymanager I want to retain the above order in the queryresults
Views
Replies
Total Likes
Usually you don't have a search when you want the node order and can simply use navigational access (node.getNodes()) in that case. Example at [1] and then in logic you can apply filter.
In Jackrabbit/CRX you can globally configure "respectDocumentOrder" 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.
[1]
<%
Resource r = slingRequest.getResourceResolver().getResource( "/content/geometrixx/en");
Node rootNode = r.adaptTo(Node.class);
NodeIterator it = rootNode.getNodes();
while(it.hasNext()){
Node node = it.nextNode();
%>
<%=node.getName()%>
<%
}
%>
Views
Replies
Total Likes
Hi Thanks,
If I was to do node.getNodes() how heavy a call is this compared to me doing a search use querymanager with all the filters applied?
thanks
Views
Replies
Total Likes
it all deponds on your structure & number of nodes. respectDocumentOrder will surely be expensive compared to node.getNodes()
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies