Skip to content
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

Fix filtering null values in where() with Meilisearch #901

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

tobz-nz
Copy link
Contributor

@tobz-nz tobz-nz commented Jan 20, 2025

Currently filtering attributes by null value returns incorrect results.

TestModel::search('test')->where('parent_id', null)->count();
// 0

This is because the generated filter value is parent_id="". The correct value filtering for null is parent_id IS NULL and this PR fixes it.

A way to get around this bug is:

TestModel::search('test')->options(['filter' => 'parent_id IS NULL'])->count();
// x

But that's not very intuitive or convenient ;)

@taylorotwell taylorotwell merged commit 74be50b into laravel:10.x Jan 20, 2025
19 checks passed
@tobz-nz tobz-nz deleted the patch-2 branch January 20, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants