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

Typesense does not handle "whereNotIns" #876

Open
alexfierro opened this issue Nov 6, 2024 · 3 comments
Open

Typesense does not handle "whereNotIns" #876

alexfierro opened this issue Nov 6, 2024 · 3 comments

Comments

@alexfierro
Copy link

Scout Version

10.11

Scout Driver

Typesense

Laravel Version

11.29

PHP Version

8.2.23

Database Driver & Version

No response

SDK Version

No response

Meilisearch CLI Version

No response

Description

When using the Typesense driver, the "whereNotIn" constraints are never handled.

Within the "filters" function in TypesenseEngine.php, we can see that it handles the $builder->wheres and $builder->whereIns, but never the $builder->whereNotIns.

It should be as simple as adding a "parseWhereNotInFilter" function that does the same thing as the existing parseWhereInFilter, but changing %s:=[%s] to %s:!=[%s].... and then calling that function in the filters function.

Steps To Reproduce

This works in Typesense. (It returns matching searches where id is 10 or 11)

Content::search('foo')->whereIn('id', [10,11])->get();


This does not work as expected. (It returns all matching searches including ones where id is 10 or 11 because whereNotIn is never evaluated.)

Content::search('foo')->whereNotIn('id', [10,11])->get();

Copy link

github-actions bot commented Nov 7, 2024

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@tharropoulos
Copy link
Contributor

I've posted a PR for this, it should fix your problem. The Typesense driver didn't take whereNotIn into account when constructing its filter clause.

@tharropoulos
Copy link
Contributor

@alexfierro Just checking in if that PR did indeed fix your problems with whereNotIns, as this issue is still open. If it didn't fix your problem, feel free to provide a reproducible example so I can go into further investigations regarding this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants