I am using QueryBuilder for search on my website, which is on AEMaaCS 6.5 2023.01
TLDR: Is there a way to query for pages and apply boosting based on tags?
For example, I am trying to find 'related' pages to a blog post page. The blog post has 3 tags associated with it. I would like to search for all blog posts, and boost results that have any one of the tags to the top. I would order the results by relevance, and then by date, and take the first 4 returned. In some platforms this is called 'boosting', but I couldn't find anything like this in the AEM documentation. I believe Lucene supports boosting using a "^" caret, for instance: Apache Lucene - Query Parser Syntax
Views
Replies
Total Likes
For boosting search results based on a specific field, you can do the following
we have a property called boost -> set it to a higher value say 2.0 (on tags field in this case) within the index definition.
For example,
path=/content/we-retail
type=cq:Page
fulltext=biking
p.limit=-1
Thanks. How do you reindex?
And would this work if I am searching for: TagA or TagB or TagC, and I want results that have all 3 tags to come before results that have any of the two tags, which come before results that have just one tag, etc?
@dylanmccurry , you can use
path=/content/we-retail
type=cq:Page
group.1_property=jcr:content/@cq:tags
group.1_property.value=we-retail:apparel/pants
group.2_property=jcr:content/@cq:tags
group.2_property.value=we-retail:apparel/shirt
group.p.or=true
p.limit=-1
A short article of
This seems to work, but ordering is not working as expected. Each hit in the results has a score of 0.01. How can we influence the score correctly so that we can sort by items which have more tags that overlap as opposed to fewer tags that overlap?
e.g., when I call `hit.getScore()` a value of 0.01 is returned for all hits.
Views
Likes
Replies
Views
Likes
Replies
Views
Like
Replies