Increase the score of the last resource of each type

Hello friends,

I'm facing a problem and i really don't know how handle it.
Actually I have a "simple" research on a class called "Resource". These resources have a specific type but are show in a unique list with all the types. All the search part is working with different filters etc.

What I want to do is to increase the score (x10) of the last (date) resource of each type.
For example I actually have :
Resource 4 - Type C - Date 21/01/2019
Resource 7 - Type C - Date 20/01/2019
Resource 5 - Type A - Date 18/01/2019
Resource 2 - Type A - Date 17/01/2019
Resource 6 - Type C - Date 17/01/2019
Resource 3 - Type B - Date 12/01/2019
Resource 1 - Type B - Date 10/01/2019
And I want :
Resource 4 - Type C - Date 21/01/2019 -> score x10
Resource 5 - Type A - Date 18/01/2019 -> score x10
Resource 3 - Type B - Date 12/01/2019 -> score x10
Resource 7 - Type C - Date 20/01/2019
Resource 2 - Type A - Date 17/01/2019
Resource 6 - Type C - Date 17/01/2019
Resource 1 - Type B - Date 10/01/2019

I hope this is comprehensible and you understand my needs
Thanks for you attention and help :slight_smile:

Little up! to maintain visibility :slight_smile:

are you really interested in scoring those up or do you really want them to be the top matches and displayed at the top of your list?

if the latter, how about executing two searches:

  1. The first uses field collapsing against the resource and sorts by timestamp.
  2. the second executes your regular query (you could exclude the id's of the documents found in the first search request so they do not show up in your result set).

Would that work or is your use-case different?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.