puks1978
puks1978

Reputation: 3697

MySQL match against +(search query) not working but +search +query is

I have a textinput field where users can enter a search query which I am performing a match against on in MySQL. The user can enter multiple words or single words however when I use +(search query) I get no results however when I use +search +query I get the desired results.

Works

MATCH (title) AGAINST ('+new +painting' IN BOOLEAN MODE)

Does not work

MATCH (title) AGAINST ('+(new painting)' IN BOOLEAN MODE)

First time user of MATCH AGAINST so not sure what I am doing wrong.

Thanks

Upvotes: 1

Views: 768

Answers (1)

Ursula
Ursula

Reputation: 412

For all titles with the string "new painting":

MATCH (title) AGAINST ('+"new painting"' IN BOOLEAN MODE)

For all titles with boths the strings "new" and "painting":

MATCH (title) AGAINST ('+new +painting' in BOOLEAN MODE)

For more options, and different operators, consult the documentation: http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html

Upvotes: 2

Related Questions