This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
I am create javax.jcr.Query using xpath. The issue with this is that it doesn't have Pagination support in the QueryResult unlike SearchResult from cq package.
I wanted to be able to get dynamic search fields and search.
constructing xpath is easy and I found the search is faster as well. Can Some one help to get the Pagination support in QueryResult or
Convert javax.jcr.Query to cq Query?
My current Code:
QueryManager qm=session.getWorkspace().getQueryManager();
Query query = qm.createQuery(xpathQuery.toString(), Query.XPATH);
QueryResult result = query.execute();
for (NodeIterator iterator = result.getNodes(); iterator.hasNext();) {
}
Also can you please confirm my understanding about xpath search is faster compared to querybuilder?
Thanks for your support
Solved! Go to Solution.
Views
Replies
Total Likes
Look here in JCR API docs - it states xpath is depreciated:
http://www.day.com/specs/jsr170/javadocs/jcr-2.0/javax/jcr/query/Query.html
http://stackoverflow.com/questions/24903623/sql2-equivalent-for-this-xpath-query
QueryBuilder API supports pagination and built upon JCR api:
By default the Query Builder would also provide the number of hits. Depending on the result size this might take long time as determining the accurate count involves checking every result for access control. Mostly the total is used to implement pagination for the end user UI. As determining the exact count can be slow it is recommended to make use of the guessTotal feature to implement the pagination.
For example, the UI can adapt following approach:
https://docs.adobe.com/content/docs/en/aem/6-0/develop/search/querybuilder-api.html
Views
Replies
Total Likes
Look here in JCR API docs - it states xpath is depreciated:
http://www.day.com/specs/jsr170/javadocs/jcr-2.0/javax/jcr/query/Query.html
http://stackoverflow.com/questions/24903623/sql2-equivalent-for-this-xpath-query
QueryBuilder API supports pagination and built upon JCR api:
By default the Query Builder would also provide the number of hits. Depending on the result size this might take long time as determining the accurate count involves checking every result for access control. Mostly the total is used to implement pagination for the end user UI. As determining the exact count can be slow it is recommended to make use of the guessTotal feature to implement the pagination.
For example, the UI can adapt following approach:
https://docs.adobe.com/content/docs/en/aem/6-0/develop/search/querybuilder-api.html
Views
Replies
Total Likes
Thanks for your reply.
I dont see xpath search is deprecated in 6.1. It is easy to build query using xpath than QueryBuilder.
How do I add search attributes dynamically
.
My xpath query is
/jcr:root/content/dnb/home/lc//*[jcr:contains(@jcr:title,'market') or jcr:contains(@description,'market') or jcr:contains(@title,'market') or jcr:contains(@text,'market') or jcr:contains(@html,'market') and (jcr:contains(@cq:tags,'function:cmo') or jcr:contains(@cq:tags,'function:credit') )]
Pseudo Logic:
(title=market or description = market)
and
(tags=cmo or tag=credit)
Can you help me to construct this in Query builder?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies