Need to type a space to get good results

At https://www.lebikini.com/search/
If I’m looking for concerts of “Arno”, the results are good only if I type a space after: "Arno ".
Otherwise, I only get a few concerts of that actual artist, and the rest are less relevant concerts.
My index settings is defined like this:

index.setSettings({
  queryLanguages: ['fr'],
  searchableAttributes: ['title', 'style'],
  attributesForFaceting: ['clubbing', 'categories'],
  customRanking: ['asc(date_score)'],
  ranking: ['custom', 'typo', 'words', 'filters', 'proximity', 'attribute', 'exact'],
})

Any idea why? Any tweak I can perform?
Thanks for the help!

Hi @antoine!

You should be able to leverage the exactOnSingleWordQuery parameter to solve the issue, try setting it to “word”!

Looking at your settings, I can see that you have modified the order of the ranking criteria. Setting the custom ranking criteria before all other criteria will create this kind of noise in the search result, so we strongly recommend not to change the order of the ranking formula as it has been optimised for the vast majority of use cases!

You can find advice on how to make best use of your Algolia settings here: https://www.algolia.com/doc/guides/going-to-production/implementation-checklist/.

I hope this helps!

Hi Marie,
Thanks for the answer. I tried to set exactOnSingleWordQuery to word but it didn’t fix the issue.
I do have a custom ranking because I want the future concerts to show up first, in ascending date order, then the past ones, in descending order.
That is why I have set

customRanking: ['asc(date_score)'],
ranking: ['custom', 'typo', 'words', 'filters', 'proximity', 'attribute', 'exact'],

and for each concert I calculate date_score like this:

if (future) {
  date_score = 1 - 1000000000 / date
} else {
  date_score = 1 + 1000000000 / date
}

Where date is the concert date as a unix timestamp (in seconds then). I came up with this thanks to your support team in January.
Mael from the Solutions Engineer team explained me:

  • Future events would get an attribute date_score = 1 - (1 / timestamp). (which is always < 1, so future dates come first)
  • Past events would get an attribute date_score = 1 + (1 / timestamp). (which is always > 1, so past dates come last)
  • Then, set date_score (asc) as a custom ranking.

And then José-Paul Dominguez explained to me:

you might want to rank your results first with this custom ranking attribute and then with the textual relevance.

I suppose my ranking array setting is wrong but I can’t find a way to make it right.
Basically I want people to be able to search for concert titles by keywords, and the results are sorted by date (near future, then far future, then near past, then far past), but if they type an artist name I don’t want the proximity/typo to show up before the exact matches, e.g. “Arno” should be the same as "Arno ".

Also, why do I see only “Custom ranking” on this dashboard page:
/apps/xxxxxxx/explorer/configuration/events/ranking-and-sorting
Since I define an array with more than one ranking with setSettings? Is my setting taken into account? (maybe there is a bug in your UI?)

Thanks. Any help would be appreciated.

Update: I was able to improve the results and fix the space issue by moving custom to the end of the ranking array. Although this gives less priority to the chronological ranking, the results are less confusing now, but I would still love to get some advice :wink: