laravel-query-builder
laravel-query-builder copied to clipboard
Passing empty value to filter causes slowness
Thanks for the package! Really enjoying it!
In my testing it appears that empty filters cause some hefty delays. It appears the delays are in the code, not the database query.
I have a very small project, the table I am querying has only 4 records.
I have the following in my controller:
$q = QueryBuilder::for(Meet::class)
->allowedFilters([
AllowedFilter::partial('name'),
])
->allowedSorts(['name'])
->dd();
Note that I am doing the dd
there.
I query using Postman get the following response times:
{{host}}/meets
-> 23ms
{{host}}/meets?filter[name]=
-> 325ms
Adding ->ignore([null, '', ' '])
(or any/all variations of that) appears to have no impact on the response time.
In all cases the dd
query shows the same select * from meets
as expected / desired.
Using:
"spatie/laravel-query-builder": "^5.0", (5.0.2)
Laravel Framework 9.15.0
PHP 8.1.6 (cli)
macOS
latest
Thank you and please let me know if I can provide helpful additional information.
Hi @jeffwhansen 👋
Thanks for reporting the issue. Can you provide me with an example app that reproduces the described slowdown? I'd like to look into this issue.
Hi, I'll be closing this issue due to inactivity. If you or anyone else are still experiencing this problem, feel free to open a new issue and we'll happily look into it :) Thanks!