Expand my Community achievements bar.

SOLVED

How to get the search result in such order that the words matched most are in the beginning the list.

Avatar

Level 6

If I have a page A tagging with multiple tag values, I want to use the tag values in Page A as search criteria and find out which other pages have one or more than one tag values, I would like the search result returning as the order such, the page should be the first in the list if all tag values are matched, second page in the list should be the one matching (tag values -1), and in this order. Can I use jcr:score for that?

Please help. Thanks.

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

jcr:score

1. If you are runing a search for page where title contains "xxx" then jcr:score will always be calculated when you use "contains" function in your query and actually jcr:score gives the proximity of those pages matches your condition (that is your specific implementation)

Now another example

2. If you are running a search for pages let say based on modified date then in that case the jcr:score will have some value but that is not supportive to your search as you already searched pages based on modified date and its already sorted but still jcr:score will consist some value while be used not by you but by system when again same search runs.

3.If your search has more than one term and one of the terms is a common term in the repository, then that common word gets less weightage. For e.g. if your content is for the company Polycom, then term like ‘conference might be a common term. So, when you search for ‘VOIP Conference’, then ‘conference’ would get lower weightage.

The Score is calculated using pretty complex mathematical formula. You can read more about it at http://lucene.apache.org/core/3_6_2/api...ilarity.html .Some more explanation is provided at http://www.lucenetutorial.com/advanced-t...oring.html .

 

For Searching pages with tags :- http://stackoverflow.com/questions/18912037/search-pages-with-a-tag-in-cq5 or https://docs.adobe.com/docs/en/cq/5-6-1/wcm/tag_admin.html#Searching%20for%20Tags

 

You can implement your use case by custom component by using concept of EDIT DISTANCE ALGO (Link:- http://www.geeksforgeeks.org/dynamic-programming-set-5-edit-distance/)

I hope this would help you.

 

PS:- This is DTM Forum, please post questions on AEM Forum :- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

1 Reply

Avatar

Correct answer by
Administrator

Hi 

jcr:score

1. If you are runing a search for page where title contains "xxx" then jcr:score will always be calculated when you use "contains" function in your query and actually jcr:score gives the proximity of those pages matches your condition (that is your specific implementation)

Now another example

2. If you are running a search for pages let say based on modified date then in that case the jcr:score will have some value but that is not supportive to your search as you already searched pages based on modified date and its already sorted but still jcr:score will consist some value while be used not by you but by system when again same search runs.

3.If your search has more than one term and one of the terms is a common term in the repository, then that common word gets less weightage. For e.g. if your content is for the company Polycom, then term like ‘conference might be a common term. So, when you search for ‘VOIP Conference’, then ‘conference’ would get lower weightage.

The Score is calculated using pretty complex mathematical formula. You can read more about it at http://lucene.apache.org/core/3_6_2/api...ilarity.html .Some more explanation is provided at http://www.lucenetutorial.com/advanced-t...oring.html .

 

For Searching pages with tags :- http://stackoverflow.com/questions/18912037/search-pages-with-a-tag-in-cq5 or https://docs.adobe.com/docs/en/cq/5-6-1/wcm/tag_admin.html#Searching%20for%20Tags

 

You can implement your use case by custom component by using concept of EDIT DISTANCE ALGO (Link:- http://www.geeksforgeeks.org/dynamic-programming-set-5-edit-distance/)

I hope this would help you.

 

PS:- This is DTM Forum, please post questions on AEM Forum :- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni