Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Boosting at field/property level in case of jcr sql2 versus Querybuilder

Avatar

Level 9

HI All,

Details as below :

In case , we are searching for certain properties at the page jcr:content level or at the page component level, based on the keywords provided on the search page. Along with it, we would want to provide some boosting at field/property level.

In this scenario :

a] Is it something like we can only take the jcr-sql2 query approach to meet this requirement?

b] In case it can be done via querybuilder approach too, can you please provide any references articles/pointers on the same.

Any thoughts/pointers on this will be really helpful.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Yes the query is definitely going to be slower as you are doing inner joins with nested child nodes. As suggested in the first thread it would have been better if you can just process the returned paths returned by the simple query programmatically to get the page paths instead of firing query with joins. 

View solution in original post

7 Replies

Avatar

Employee Advisor

You can set the boost property in the index configuration for properties which would you like to have higher search relevancy. See the Boost and Search relevancy documentation here - 

`https://jackrabbit.apache.org/oak/docs/query/lucene.html#boost 

Avatar

Level 9

Hi Kunal,

Thank you for your reply.

The article you mentioned provides details on boosting the page properties, by making some configuration changes. However, the problem is initially the code for boosting was written via jcr-sql2 query and we will have to achieve this by means of code itself.

So, wondering if there is a way it can be done via Query Builder way or jcr-sql2 is the only option.

Any thoughts here would be helpful.

Avatar

Employee Advisor

Well I did not understand your question completely. But the run time boosting is indeed supported by jcr contains function - https://helpx.adobe.com/experience-manager/kb/BoostInSearch.html

Avatar

Level 9

Hi Kunal,

Sorry for not being clear. 

This in is continuation to the query posted [http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage... ], on which you have been guiding me.

Now, looks like with the below query

SELECT * FROM [cq:Page] AS parent INNER JOIN [nt:base] As s ON ISDESCENDANTNODE(s,parent) WHERE ISDESCENDANTNODE(parent,[/content/x/y]) AND (CONTAINS(s.[cq:tags],'ABC*^600') OR CONTAINS(s.blocktitle,'ABC*^400')  OR CONTAINS(s.bodycopy,'ABC*^100')  OR CONTAINS(s.headingText,'ABC*^10') OR  CONTAINS(s.Author,'ABC*^400')  OR CONTAINS(s.headline,'ABC*^2')  OR CONTAINS(s.[jcr:title],'ABC*')  OR CONTAINS(s.[cq:tags],'DEF*^600') OR CONTAINS(s.blocktitle,'DEF*^400')  OR CONTAINS(s.bodycopy,'DEF*^100')  OR CONTAINS(s.headingText,'DEF*^10')  OR CONTAINS(s.Author,'DEF*^400') OR  CONTAINS(s.headline,'DEF*^2') OR CONTAINS(s.[jcr:title],'DEF*'))  AND ( NOT parent.[hideInSearch] IS NOT NULL) ORDER BY parent.[jcr:lastModified]

 

a] Things are working fine for multiple keyword search[fulltext and partial].

b] Only thing is that its a bit slow. So, we were wondering if the same thing can be converted to a Query builder approach one?

Avatar

Correct answer by
Employee Advisor

Yes the query is definitely going to be slower as you are doing inner joins with nested child nodes. As suggested in the first thread it would have been better if you can just process the returned paths returned by the simple query programmatically to get the page paths instead of firing query with joins. 

Avatar

Level 10

Agreed - this is a complex query (you have a lot of OR conditions) and the performance will take a hit. 

Avatar

Level 9

Hi Kunal,

Thank you for your reply.

Sorry for not being clear.

The question I had was 

a] In the query posted in this thread above, boosting is done by making use of JCR-SQL2.

b] So, is boosting property values possible only via JCR-SQL2 or via Quer builder approach too?

c] If possible via Query builder approach too, can you please provide any pointers/reference code for the same.

Any thoughts on this will be helpful.