Expand my Community achievements bar.

SOLVED

QueryBuilder

Avatar

Level 7

Hi,

JCR-1 has specs for XPath and JCR-SQL.

JCR-2 has specs for JCR-SQL-2 and JQOM.

1. In this context, where does QueryBuilder stand?

2. Is QueryBuilder not a spec from JCR at all?

3. Could we say that we have in all, we have 5 types of Searches ( XPath, JCR-SQL, JCR-SQL-2, JQOM, and QueryBuilder)?

4. When should/could QueryBuilder be used?

Appreciate your quick response.

Thanks,

Rama.

1 Accepted Solution

Avatar

Correct answer by
Employee

A colleague, David Gonzalez, summarised why to use QueryBuilder very well:

1. It simplifies making complex parametised queries

2. It should auto-optimize query evaluation

3. Extension points for adding custom behaviour(custom predicates, Hit Writers etc)

4. Provides pagination, facets etc

There is no reason why you have to use QueryBuilder, but it can be less confusing to use than writing path/JCR queries.

Regards,

Opkar

View solution in original post

3 Replies

Avatar

Level 10

QueryBuilder is built on JCR API. Here is a good stackoverflow thread that talks about this subject:

http://stackoverflow.com/questions/29717580/cq-querybuilder-api-why

Avatar

Level 7

Hi,

Thanks for sharing that useful URL.

I could not get answers to my above questions.

My fifth question would be:

5. When should QueryBuilder be used as opposed to XPath, JCR-SQL, JCR-SQL-2 and JQOM?

How are these 5 searches related?

Thanks,

Rama.

Avatar

Correct answer by
Employee

A colleague, David Gonzalez, summarised why to use QueryBuilder very well:

1. It simplifies making complex parametised queries

2. It should auto-optimize query evaluation

3. Extension points for adding custom behaviour(custom predicates, Hit Writers etc)

4. Provides pagination, facets etc

There is no reason why you have to use QueryBuilder, but it can be less confusing to use than writing path/JCR queries.

Regards,

Opkar