Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Search results: is there a way to boost "newness" in relevance?
Hi all,
Can we boost "newness" in search results, the way we can for title match?
I don't mean to order results by date. Just to factor the date into relevance, giving more relevance to newer results.
TIA
Fernando
I am extremely glad you asked this question because I've just learned how to use the Range query with Liferay's Custom Filter widget (see the helpful examples article too). I've tested a bit on DXP 7.3 SP1 and here's what I've found, using this Jira ticket comment as a guide:
Complex Query Builder takes a single string value per query.
Range Query can take up to 4 input values: gte, gt, lte, lt.
Therefore, we must implement parsing to extract these input values from the single string.
Suggested notation:
[10 20] => gte: 10, lte:20
]10 20[ => gt: 10, lt:20
[10 20[ => gte: 10, lt:20
]10 20] => gt: 10, lte:20
[now/d now+1d/d[ => gte: now/d , lt: now+1d/d
Add a Custom Filter to a page and configure it like this:
Filter Field: modified
Filter Value: [20210617175020 now/d]
This catches stuff greater than or equal to June 16 and less than or equal to now (I don't know if that's best)
Filter Query Type: Range
Occur: should
Boost: 500 (or whatever you want)
Add more Custom Filters and for the other date ranges you want to set
different boost values for.
I've created LRDOCS-9576 so we can create documentation for this special query case.
Thanks Russell! I'll give it a try on 7.3.
Unfortunately, our customer is currently running 7.2, but this might be an extra motivation to upgrade.
Powered by Liferay™