Reputation: 11
I am trying to search using Laravel Scout Algolia with filtering LIKE Strings
public function search(Request $request)
{
$filter = $request->filter; // Filter {"name": "pan"}
$q = $request->q;
$results = Product::search($q)
->where('name', 'LIKE', '%'.$filter->name.'%')
->paginate(10);
return $results;
}
This code is not working because where clause is running only on certain operations such as
=, !=, IN, EXISTS, etc..
.
Problem is that if I used =
operator it will be an exact match to a string while user may type part of the string.
Upvotes: 1
Views: 218