page sorting on siteadmin | Community
Skip to main content
Level 4
October 16, 2015
Solved

page sorting on siteadmin

  • October 16, 2015
  • 7 replies
  • 2488 views

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 

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. 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()%>
<%
}
%>

7 replies

smacdonald2008
Level 10
October 16, 2015

Can you please provide more details on what you want to do. You want to use SiteAdmin to order pages? 

chrisu168Author
Level 4
October 16, 2015

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

Sham_HC
Level 10
October 16, 2015

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

chrisu168Author
Level 4
October 16, 2015

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

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. 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()%>
<%
}
%>

chrisu168Author
Level 4
October 16, 2015

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

Sham_HC
Level 10
October 16, 2015

it all deponds on your structure & number of nodes.  respectDocumentOrder will surely be expensive compared to node.getNodes()