How to sort records on the number of hits on searchable attributes, and not only on the best matching attribute?

Hello all,
I’m looking for a solution on a use case we have :slight_smile:
Let’s imagine I have a blog, with attributes:

{
objectID: '1',
title: 'Blog about puppies',
description: 'blablabla blablabla',
author: 'John Doe',
tag: 'dogs'
},
{
objectID: '2'
title: 'Blog about puppies',
description: 'blablabla talking about puppies blablabla',
author: 'John Doe',
tag: 'puppies'
}
{
objectID: '3'
title: 'Some title',
description: 'blablabla talking about puppies blablabla',
author: 'John Doe',
tag: 'puppies'
}

I have searchable attributes like this:

title,
description,
tag

I search for ‘puppies’, the first record will be Object 1 (best matching attribute is title).
Then it will display Object 2 and 3 base on ObjectID.

But how would I be able to make the second record (ObjectID = 2) be ranked higher than the first record (ObjectID = 1) because there are more matching attributes after (1 - title, vs 3 - title description and tag)

I would appreciate any advice on how to find the solution :wink: Thanks!

Hi @phoenix

We tend to steer clear of word repetition as a ranking criteria because historically it doesn’t improve results the way you would expect. That said, I found reference to an API setting that allows you to configure this to try it out.

I will DM you the setting if you want to try it out and see if it improves results for your use case.

Hi @chuck.meyer !
Thank you very much for your reply, and the solution provided. I will try it, and see if it fits :slight_smile: and update this post.
I must say, I was surprise when I started to look at that subject, that it wasn’t working like I thought.
I (and my stakeholders ^^) kinda want to rank higher results with lot of hits on my keyword, rather than just one, that is simply on a ‘better’ attribute if that make sens…

1 Like

Give it a shot. It may be the right fight for your use case. In the meantime, I’m going to see if we can get this setting officially documented.

OK, so update: it is not working. Solution offered with the API setting is not working, unfortunately.
Is it possible to have another clue on how to achieve our goal?