Is there any advantages of using Querybuilder API instead of JCR search api?
And as we know that QueryManager wll come into picture in case of JCR search api just to create query and here Querybuilder is use to create query ...is there any extra benfit using Query Builder API instead of QueryManager ?
I have checked all possible links available by searching these keywords but exact difference and benefitsI did not get .
Solved! Go to Solution.
Hi,
Query builder is built on top of JCR Query API. When we use query builder, we deal with a map of predicates instead of queries. The Out of the box predicates work in most situations. The limit and offset features work like a charm for pagination situations. Grouping let's you write complex queries in a very readable manner. One more nice feature is the faceted search, your search results can be split by tags. Query builder returns resources and not the nodes, so you don't have to handle to deal with the checked repository exceptions that come along with JCR API ( https://cqdump.wordpress.com/2012/11/06/cq5-coding-patterns-sling-vs-jcr-part-1/ ).
Since it is exposed as a REST servlet, it is often used in building interfaces like custom dashboards and the familiarity helps.
For more details, please refer following articles:
cq5 - CQ QueryBuilder API.. why? - Stack Overflow
Exact difference between Jcr-xql2, xpath query and query builder api
I hope this information helps!
Regards,
Lavanya Malyala
Hi,
Query builder is built on top of JCR Query API. When we use query builder, we deal with a map of predicates instead of queries. The Out of the box predicates work in most situations. The limit and offset features work like a charm for pagination situations. Grouping let's you write complex queries in a very readable manner. One more nice feature is the faceted search, your search results can be split by tags. Query builder returns resources and not the nodes, so you don't have to handle to deal with the checked repository exceptions that come along with JCR API ( https://cqdump.wordpress.com/2012/11/06/cq5-coding-patterns-sling-vs-jcr-part-1/ ).
Since it is exposed as a REST servlet, it is often used in building interfaces like custom dashboards and the familiarity helps.
For more details, please refer following articles:
cq5 - CQ QueryBuilder API.. why? - Stack Overflow
Exact difference between Jcr-xql2, xpath query and query builder api
I hope this information helps!
Regards,
Lavanya Malyala
Nice response and correct!
Hi Lavanya ..Thanks ...very Helpful
some doubts if you can clear this also it would be very helpful.
in JCR api as well we can get this
Query query = queryManager.createQuery(queryString, Query.SQL);
QueryImpl q = (QueryImpl) query;
q.setLimit(10);
q.setOffset(10);
we can set this ....??
Views
Replies
Total Likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | String fulltextSearchTerm = "Geometrixx" ;
|
Views
Replies
Total Likes