MySQL Forums
Forum List  »  Full-Text Search

+/- with phrase searches
Posted by: Chuck Becker
Date: September 16, 2005 05:27PM

When using MATCH(...) AGAINST(... IN BOOLEAN MODE), should the '+' and '-' operators work together with the double-quote phrase seacrhing operator?

I couldn't find in the documentation where this is definitively ruled out or in, and after some searching on this forum and elsewhere I was unable to find anyone else discussing the issue, but I can't seem to get it to work. Can someone enlighten me or help me figure out what I'm doing wrong?

For example, I have the query:

SELECT uid, interests
FROM user
WHERE MATCH(interests) AGAINST('
+"Curriculum"
-"Student Assessment and Standards"
'IN BOOLEAN MODE)
ORDER BY uid

This yields:
+-----------------------------------------------------+
|uid| interests |
+-----------------------------------------------------+
|16 |Human Resources and Professional Development |
| |Student Assessment and Standards |
+-----------------------------------------------------+
|23 |Leadership and Management |
| |Curriculum |
| |Student Assessment and Standards |
| |Teaching Students with Diverse Needs |
+-----------------------------------------------------+

'interests' is a TEXT field in table user (MyISAM) with a FULLTEXT index on it. The 'interests' field contains line endings (I cleaned up the formatting from mysql output to make it easier to read).

Notice the first returned result doesn't contain the 'required' phrase but does contain the 'must not be present' phrase.

I also tried parenthese around the phrases:

SELECT uid, interests
FROM user
WHERE MATCH(interests) AGAINST('
+("Curriculum")
-("Student Assessment and Standards")
'IN BOOLEAN MODE)
ORDER BY uid

...which gives the same result. I tried repairing and optimizing the table. Experimenting with some other queries, putting the + or - in front of the double-quoted phrase sometimes seems to have the expected effect, but not in this case or several other cases I've tried. Am I missing something here?

Thanks in advance,

Chuck

Options: ReplyQuote


Subject
Views
Written By
Posted
+/- with phrase searches
2984
September 16, 2005 05:27PM


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.