searchable: SQL error when paginate after search on Laravel v5.1.9+
Hi,
I got this error when I perform paginate on Laravel version 5.1.9 and above:
QueryException in Connection.php line 636:
SQLSTATE[HY000]: General error: 2031 (SQL: select count(*) as aggregate from (select ....
My code:
user::search('John', null, true)->paginate(10);
This error does not occur on normal get()
user::search('John', null, true)->get() // no error;
It also does not occur on Laravel v5.1.8 and below
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 4
- Comments: 62 (9 by maintainers)
Another temporary solution similar to @woodytang, but as a single helper function instead (needs to be included globally in a helpers file of some sorts):
Usage:
Note that it will retrieve ALL results, and trim the resulting collection.
Yup tested in Laravel 5.2, works like a charm
#126 should solve the problem
Guys, why don’t you abandon this package? This bug has been open for 12 months, with no movement. I was great while it lasted, but Laravel 5.3 introduced Scout, and with Scout you can easily use Algolia (and their free tier).
I did the switch the other day, took me less than 30 minutes, and has a bunch more other benefits.
We need to accept the fact this guy don’t care this bug, someone knows another packages like this?