Search results: is there a way to boost "newness" in relevance?

thumbnail
Jamie Sammons, modified 4 Years ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts

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

thumbnail
Fernando Fernandez, modified 4 Years ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts

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.

thumbnail
Fernando Fernandez, modified 4 Years ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts

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.