Implement relevancy

Created on 17 April 2024, 12 months ago
Updated 4 June 2024, 10 months ago

Trying to optimize our boost settings I though it would be a good idea to display the Relevance in the search results view. But this constantly says "1" no matter how slightly related the result is (containing just one similar term out of 2 search terms).

I gather from the Meilisearch documentation

The _rankingScore is a numeric value between 0.0 and 1.0.

If I'm not mistaken the Search: Relevance field should consenquently produce a float number. Maybe I am mistaken, then please change the issue component to "Dokumentation" ;-)

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany hexabinaer Berlin, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hexabinaer
  • 🇩🇪Germany hexabinaer Berlin, Germany

    Ah yes, I should have had a look at the Log before writing:

    Deprecated function: Implicit conversion from float 0.75 to int loses precision in Drupal\Core\Template\TwigExtension->withoutFilter()

  • First commit to issue fork.
  • 🇦🇹Austria tgoeg

    I am also trying to track down relevancy problems as my boosts don't seem to cause any difference (but I think that the API key I use - intentionally not the master key - has some permission problems).

    Relevancy is also always 1, in my case (in the view display for anonymous users). However, I do not get these errors in the log.
    Do you have any custom twig involved that's possible typecasting to int here?

    Or maybe this is a bug and my relevance is always 1 indeed (which won't cause any typecasting errors :) ). Which makes me wonder, I'd definitely like to see different relevancy. Your output seems to imply there is some relevancy that's not 1, which puzzles me.

    I don't think this module reports any relevancy at all, yet, however.

    https://php-sdk.meilisearch.com/classes/Meilisearch-Contracts-SearchQuer... says it would be $showRankingScore.
    I don't see any mention of this in the code, should be in some $meiliOptions I guess.

  • 🇩🇪Germany hexabinaer Berlin, Germany

    Yes sorry, I might have been mislead. The conversion from float to integer is probably totally unrelated.

    However, I am still puzzled why the relevancy is always "1", no matter what operator I set, e. g. "Contains any of these words" (parse mode for fulltext search is "Multiple words")

  • 🇦🇹Austria tgoeg

    Meilisearch itself and the PHP SDK/API allow for providing effective relevancy. It's just that this very module does not yet implement this and I guess a relevancy of 1 is the default, then.

    I tend to say we should transform this into a feature request?

  • 🇩🇪Germany hexabinaer Berlin, Germany

    Right so :-)

  • 🇩🇪Germany hexabinaer Berlin, Germany
Production build 0.71.5 2024