Does the Search: Relevance field give any relevant information?

Created on 17 April 2024, over 1 year 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" ;-)

💬 Support 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

Merge Requests

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
  • 🇸🇮Slovenia deaom

    deaom changed the visibility of the branch 3441489-does-the-search to hidden.

  • 🇸🇮Slovenia deaom

    The Ranking Score option was added to search function, so it's always set to true (turned on). The search api relevancy field that is used in views and added as a display, was updated in meili to display the rankingScore returned from search. There is a simple test added that checks that relevancy is present as default and then changes when there are results. Those tests are passing.
    For some reason the synonyms tests are now failing with the ranking score change, that is why the status is set to needs work and MR is placed in draft.

Production build 0.71.5 2024