I'm trying to write this query in Laravel
select *, MATCH(hobbies)AGAINST('soccer') from users where MATCH(hobbies)AGAINST('soccer' IN BOOLEAN MODE) LIMIT 10 OFFSET 0;
I have looked in the documentation on query builder but didn't find anything on full-text search.
Please help.
Thank you in advance :)
User::selectRaw("*, MATCH(hobbies)AGAINST('soccer')")
->whereRaw("MATCH(hobbies)AGAINST('soccer' IN BOOLEAN MODE)")
->limit(10);
Thanks to Samsquanch he pointed me in the right direction. Here is how I got it done.
$my_query = "select *, MATCH (name) AGAINST (?) from users
where MATCH (hobbies) AGAINST (? IN BOOLEAN MODE) limit 10 OFFSET ?"
$hobbies = DB::select($my_query, array($search_term, $search_term, (($page-1)*10)));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With