samedi 7 mars 2020

Full Text Search Mysql Not working with & symbol Laravel

I am trying to find these words on full text search mode.

'a&w' 'b&w' 'b & w'

The query return empty results for those words.

My query

$results = Name_tag::where('status', 2)->take(5)->groupBy('brand_id')->whereRaw("MATCH (keyword) AGAINST (? IN BOOLEAN MODE)", $this->fullTextFullTerm($input))->get();

 protected function fullTextFullTerm($input)
    {
        $reservedSymbols = ['-', '+', '<', '>', '@', '(', ')', '~'];
        $input= str_replace($reservedSymbols, '', $input);

        $words = '"'.$input.'"';
        return $words;
    }

Some words on my table

a&w
b&w
a & w
b & w

....

Other search word without & is working properly. Any idea whats wrong ? Why full text search cant find word containing & symbol in it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire