searchable
searchable copied to clipboard
Doesn't consider the whole text
Hey! Suppose, there is a record - "The White Wizard", and I search for "White" or "wizard" it gives back null result. However, it works if I search "the", "The White", "White wizard". Thank for your help! @nicolaslopezj I've noticed that searching any word alone (in a record) except the first, gives null result.
I'll second that, I'm trying to search a description text field, and can only get matches from the first word as described above. It's really easy to implement this search, but @nicolaslopezj what can we do to make any part of the text searchable?
Thanks.
Use this https://github.com/jarektkaczyk/eloquence/wiki/Builder-searchable-and-more and you can make it work flawlessly in your case. Any of these will get you your The White Wizard
row:
The
White
Wizard
The White
White Wizard
// or whole phrase only
"White Wizard"
"The White"
// also with wildcards
Wiza?d
* Wizard
and so on.
Same issue met as @saurabh-pathak94 stated, but after I reduced the number of fields on $searchable->columns
, the issue is gone. Anyone knows why?
UPDATE: it seems the problem can be fixed by changing
->search($query, null, true)
to
->search($query, 1, true)