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

Passing "empty" values to search query results in "Parameter q is required" #83

Open
justRau opened this issue Jan 4, 2024 · 0 comments

Comments

@justRau
Copy link

justRau commented Jan 4, 2024

Description

When using certain values for query string, "Parameter q is required" is thrown. More exactly, any value that returns true from empty(...) does not work.

Steps to reproduce

For example, App\Models\Taxon::search("0")->get() throws an error.

Expected Behavior

Found values should be returned.

Actual Behavior

"Parameter q is required" is thrown.

Metadata

Typesense Version:
0.25.1

OS:

Culprit

https://github.com/typesense/laravel-scout-typesense-driver/blob/master/src/Engines/TypesenseEngine.php#L208 and https://github.com/typesense/laravel-scout-typesense-driver/blob/master/src/Engines/TypesenseEngine.php#L208 runs array_filter on parameters array, therefore, removing the "0" query param, and typesense request is then missing the q parameter.

Possible solution

Change array_filter to a stricter function, such as rejecting only null values.

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

No branches or pull requests

1 participant