mysql WHERE MATCH AGAINST

7.2k views Asked by At

I am having a problem with a mysql and MATCH AGANIST.

I got this row in my database :

1:{Czy jesteśmy tutaj sami};2:{Margit Sanoemo}

I want to find this by following query :

SELECT * FROM data WHERE MATCH (params) AGAINST('*argi*' IN BOOLEAN MODE)

but I got an empty row.

However with this query :

SELECT * FROM dataWHERE MATCH (params) AGAINST('margi*' IN BOOLEAN MODE)

I get want I want.

Can you help me with double ** in params ? AGAINST('*argi*' IN BOOLEAN MODE)

2

There are 2 answers

0
Naveen Kumar On

Do not embed variables into double-quoted strings and you are set:

SELECT * FROM " . $table . WHERE MATCH (message) AGAINST ('%" . $string . "%' IN BOOLEAN MODE)

0
sephoy08 On

+

A leading plus sign indicates that this word must be present in every row returned.

-

A leading minus sign indicates that this word must not be present in any row returned.

< >

These two operators are used to change a word’s contribution to the relevance value that is assigned to a row. The < operator decreases the contribution and the > operator increases it. See the example below.

( )

. Parentheses are put round sub-expressions to give them higher precedence in the search.

~

A leading tilde acts as a negation operator, causing the word’s contribution to the row relevance to be negative. It’s useful for marking noise words. A row that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the minus operator.

*

*An asterisk is the truncation operator. Unlike the other operators, it is appended to the word, or fragment, not prepended.*

Double quotes at the beginning and end of a phrase, matches only rows that contain the complete phrase, as it was typed.