-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meilisearch return inconsistent results compared to database/algolia driver when using take()
+ query()
+ paginate()
#742
Comments
There are several issues about this like #725 but I think the gist is that you can't use the Also: are you sure you've rebuilt your search index after upgrade to Scout Meilisearch v1? Since some settings now use different keys. I tried to send in a PR to the docs about this but probably badly phrased it: laravel/docs#8704 |
If that's the case then it not possible to use Scout + Meilisearch on Laravel Nova, it require this combination to work correctly.
The reproducing repository was only generated today and all data imported to scout drivers should be using the latest index. |
with the query Algolia returns the results with a different order. this is why you seemingly get a result with algolia but not with meilisearch: Before adding a hard order on algolia: after adding a sorting to algolia: so from my point of view, the behaviour is kind of the same from the implementation side but the default relevancy and sorting of the data is different between the engines, using the same sorting mechanism would lead to the same results |
But still, the total items in the index is only 26 records, and using
I increased the total record to 200 and algolia still able to get the correct record: |
@crynobone still this happens because Algolia returns a different order of results than meilisearch, thats why you have a difference in the search results you are seeing. If we would flip the seeder on your example repo, so that the
The the This is also stated on the docs page https://laravel.com/docs/10.x/scout#:~:text=Since%20this%20callback,for%20%22filtering%22%20results A solution to your problem could be:
|
In Algolia (and the way we made the Laravel Nova + Scout + Algolia) integration before are:
|
@crynobone I think this is where the problem occurs. Are you sure that this search is not paginated before the filter is applied? It does not seem like this issue is limited to Meilisearch, the order of results from the engine used determines the result. Its like I said in laravel/nova-issues#5574
|
Closing this as this is an implementation issue in Nova. |
Scout Version
10.2.2
Scout Driver
Meilisearch
Laravel Version
10.12.0
PHP Version
8.2.6
Database Driver & Version
MySQL 8.0
SDK Version
1.1.1
Meilisearch CLI Version
No response
Description
Given the following use-case:
It should search for
"example"
using Scout driver and take only200
sample size, and from that200
sample size query using Eloquent with only records created before24 hours ago
and earlier, paginate the result using25
records per page.Steps To Reproduce
You can refer to the reproducing repository: nova-issues/issue-5574@b666ea2
composer install
cp .env.example .env
php artisan key:generate
.env
file../vendor/bin/sail up -d
./vendor/bin/sail artisan migrate:fresh --seed
./vendor/bin/sail artisan scout:import App\\Models\\UserWithAlgolia
./vendor/bin/sail artisan scout:import App\\Models\\UserWithMeilisearch
/
route from the browser.The text was updated successfully, but these errors were encountered: