MySQL Forums
Forum List  »  Full-Text Search

Problem/Solution: using negative phrases in FULLTEXT BOOLEAN MODE
Posted by: Harry Hege
Date: February 23, 2011 10:19AM

Beware, in MySQL 4.0.21, you can have problems using negative phrases with FULLTEXT in BOOLEAN MODE. I have not seen this documented elsewhere.

1. PROBLEM - You may get unreliable results when negating one/more phrases inside the MATCH-AGAINST statement:
SELECT * FROM `tbl_myisam1` WHERE
MATCH (ft_field1) AGAINST ('word1 -"word2 word3"' IN BOOLEAN MODE)

2. SOLUTION - I recommend a reliable work-around, by moving the negation outside of the MATCH-AGAINST statement:
SELECT * FROM `tbl_myisam1` WHERE
MATCH (ft_field1) AGAINST ('word1' IN BOOLEAN MODE)
and not MATCH (ft_field1) AGAINST ('"word2 word3"' IN BOOLEAN MODE)

Best wishes to my fellow MySQL FULLTEXT users.

Harry Hege

Options: ReplyQuote


Subject
Views
Written By
Posted
Problem/Solution: using negative phrases in FULLTEXT BOOLEAN MODE
3842
February 23, 2011 10:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.