Skip to content

Meilisearch & global search #6138

@beNjiox

Description

@beNjiox
  • Laravel Version: 10.39
  • Nova Version: 4.32.11
  • PHP Version: 8.3.1
  • Database Driver & Version: Postgresql 12
  • Operating System and Version: Mac Os M2 (Somona)
  • Browser type and version: Arc
  • Reproduction Repository: https://github.com/###/###
  • Meilisearch : "meilisearch/meilisearch-php": "^1.5"

Description:

I'm having an issue with the results displayed on the global search when using scout with meilisearch. I have an index "orders" which contains a "public id" of format XXXXX-XXXXX-XXXXX.
When I type an order id, I don't get the results in the order it should be. The issue is not present when searching for the same order in the index views of the resource.

When digging in the SQL query made to be used, the IDs of the rows in the DB are in the correct order. It just get reordered incorrectly.

This looks like a bug that already existed with Algolia: laravel/scout#369.

CleanShot 2024-01-09 at 07 58 13@2x

CleanShot 2024-01-09 at 07 58 59@2x

When searching for the term direct on Meilisearch, it's ordered correctly

CleanShot 2024-01-09 at 08 01 11@2x

Basically, I believe that there's some sort of reordering for the global search that override the original sorting. While trying to dig in the source, I saw the order being "killed" here : vendor/laravel/scout/src/Engines/MeilisearchEngine.php:282 (map method).

CleanShot 2024-01-09 at 08 06 09@2x

CleanShot 2024-01-09 at 08 07 03@2x

CleanShot 2024-01-09 at 08 08 40@2x

Here you can see, the IDs are different than the one expected. I have nothing in my resource class that could override the ordering.

image

Hope this is clear enough, happy to help futher if needed

Detailed steps to reproduce the issue on a fresh Nova installation:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions