teamtnt / laravel-scout-tntsearch-driver

Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch
MIT License
1.1k stars 144 forks source link

Exact search (searchBoolean) causes foreach error. #152

Closed surgiie closed 5 years ago

surgiie commented 6 years ago

So i have a model that im indexing and should be searchable by a description column and a uuid. Ive indexed the models with

php artisan tntsearch:import...

My endpoint returns search results when i search by description. However with an exact search using the uuid string i hit an issue.

Ive read that if i wanted to a an exact search i should enable searchBoolean to true in my .env. When i do this and do an exact search by the full uuid i get an exception invalid argument suplied to foreach(). Which occurs in TeamTNT\TNTSearch\Support class on line 50 in the filter method where it tries to loop over $this->items. When i dump $this->items it is showing the first segment of the uuid im trying to search.

Ex: /endpoint?q=e07ac90d-a7e9-37d0-90a6-08992e9ebb9d

The dump is e07ac90d

Oddly enough if i try to search using a partial string of the uuid instead of the full uuid(with or without search boolean enabled), it simply returns no results and does not error out. Are the uuid's not being indexed correctly? Am i missing something?

"teamtnt/laravel-scout-tntsearch-driver": "^3.0"

foreach