Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Search Ordering by jcr:score

Avatar

Level 1

Hi,

We have implemented end-user search using default CQ Query Builder search but facing some issues with the ordering of the results.

We have also applied some configurations to boost the relevancy of any property.

 

Sample Query:

/jcr:root/content//element(*, nt:base)[jcr:contains(., 'Input Term*') and (@jcr:primaryType = 'dam:Asset' or @jcr:primaryType = 'cq:Page')] order by @jcr:score descending

 

Boost in Indexing Configuration:

<index-rule nodeType="cq:PageContent">

  <property boost="100">jcr:title</property>

  <property boost="50">cq:tags</property>

  <property boost="10">jcr:description</property>

  <property boost="1">jcr:created</property>

  <property boost="1">publishdate</property>

  <property boost="1">jcr:primaryType</property>

  <property isRegexp="true">.*</property>

  <property isRegexp="true">.*:.*</property>

</index-rule>

<index-rule nodeType="nt:unstructured">

  <property boost="100">dam:WebLinkName</property>

  <property boost="100">dc:title</property>

  <property boost="50">cq:tags</property>

  <property boost="10">dc:description</property>

  <property boost="1">dc:uuid</property>

  <property isRegexp="true">.*</property>

  <property isRegexp="true">.*:.*</property>

</index-rule>

 

When we search for any keyword then we have seen that some of the pages come last in the list even if the keyword presents inside the title of that particular page.

I have also read in one of the articles on Adobe (How to use 'Boosts' at Indexing Time and at Query Runtime) that boosting works only if we search on specific property.

Please provide some insights on this issue.

Can I get the value of jcr:score from somewhere to check the ordering?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Here is an old community thread that may be helpful in checking the jcr:score value:

http://forums.adobe.com/thread/1168139

It talks about this:

" We are running a JCR SQL2 query to perform search over the content within pages. We have come across a clause "order by jcr:score" which I assume will be ordering the search results but I am not sure what is the ordering criteria"

View solution in original post

6 Replies

Avatar

Correct answer by
Level 10

Here is an old community thread that may be helpful in checking the jcr:score value:

http://forums.adobe.com/thread/1168139

It talks about this:

" We are running a JCR SQL2 query to perform search over the content within pages. We have come across a clause "order by jcr:score" which I assume will be ordering the search results but I am not sure what is the ordering criteria"

Avatar

Level 1

Hi,

The main issue which we are facing is that even after boosting the property "jcr:title" some pages with the title containing the search input term are still not coming in top.

So, I want to know

1. Whether the boosting works with my query properly or not?

2. Do we need to do some other indexing configurations to properly achieve the order?

Avatar

Level 5

Karan,

Note that after changing indexing config you have to rebuild your index in oder for changes to get reflected.

Other way to boost on property would be doing OR search for property you want to boost on. For example search in title as well as your old search criteria, in that case if keyword is present in title that will come first.

Yogesh

Avatar

Level 1

Hi Yogesh,

1. Yes, we re-built the indexes every time we change in the indexing configuration.

2. Are you suggesting to do a search on title and any other property with the full-text search. But for this case, we have to enter each and every property which can cause some relevancy issues.

But this should be the default scenario for any search term, if any keyword is present in the title, it should come first.

Karan

Avatar

Level 4

Hey wondering where do I need to plug in the xml? or this is a representation of a node. The xml configuration update you have is exactly what I need

Avatar

Level 2

Hi @aembytes 

Were you able to figure out where to put this XML config?

This is exactly what I need.

I appreciate your help.

Thank you