dimanche 12 juin 2016

FULL TEXT Search mysql laravel 5

I am working on some full text search based on multiple columns ,

it is for some car parts search where users looks for their car parts based on category items , make , model etc .

i have column model entries like :

 A3 Quatro | A3Quatro | CL550 | CL 550 | ...

But sometimes in results i have checked when users search for CL550 , it does includes results for CL550 , but not for CL 550 it should also include results model including CL550 and CL 550 or CL5 50 .

my query is

 Inventory::with('seller')->where('year', $year_id)->where('make', $make_id)->where(function($query) use ($sub_category ,$category , $model)
        {
            $query->whereRaw("MATCH(sub_category) AGAINST(? IN BOOLEAN MODE)",['+'.$sub_category.'*'])
                ->whereRaw("MATCH(category) AGAINST(? IN BOOLEAN MODE)",['+'.$category.'*'])
   //for model i tried with concat like but does not looks working 
                ->whereRaw("MATCH(model) AGAINST(? IN BOOLEAN MODE)",[$model]);
        })
    ->whereIn('seller_id', $seller_id)->paginate(10);

any comments ? as on model it does not works properly .

thanks .

Aucun commentaire:

Enregistrer un commentaire