-
Notifications
You must be signed in to change notification settings - Fork 113
Search does't work with WHERE #98
Comments
I've seen since 3.0 the Downgrade Scout back down to 7.0 and the MySQL Driver down to 2.4 and it starts working again - though no support for Laravel 8.0 |
I've hit the same issue, downgrade didn't work for me. I'm on the following versions:
I tried scout ^7.0 and mysql driver ^2.4 but still wasn't working. |
Same with me! |
For those struggling with this and looking for a quick fix: change /src/Engines/Modes/Mode.php, Line 43 To: :-) |
Search works with WHERE when using LIKE mode. NATURAL_LANGUAGE seems to have the issue. A quick fix for Natural Language: /src/Engines/MySQLEngine.php, Line 69
Change to...
It seems the NaturalLanguage.php, buildParams() method appends the search query to the params array, however, when the MySQLEngine.php search() method detects an isFullText() mode it uses selectRaw and passes the params array as bindings in the wrong order. The above fix simply uses the zero-based item from the params array (which is the search query). |
This fully fixes the issue. Any plans to merge this fix? |
I can confirm the "FIX" works for Laravel 8. |
@metrixinfo |
i am using laravel 9 with laravel scout mysql 5.1 and this one does not work where. checking it i found that the ksort changes the order in which the query is assembled, passing the first text by placing it in the first where. query builder
excerpt from the query being prepared:
string to search: conveniencia query that was executed>
commenting line 68 of /src/Engines/MySQLEngine.php, where the param is ordered with the ksort, solves the problem. |
Hello,
I have installed latest version of scout and this package.
my config
DB structure
My method is
It works perfectly if where is dropped but with where it doesn't work.
In the method
search
of this package classMySQLEngine
i have added
And run sql command directly in mysql and it returns correct result
$result['count']
of methodsearch
returns1
,$result['results']
return empty collectionSomebody can help me?
The text was updated successfully, but these errors were encountered: