MySQL Forums
Forum List  »  Docs

Special Characters in Boolean Searching
Posted by: Eric Schorvitz
Date: December 19, 2005 08:48AM

I have successfully built a PHP/MySQL job board search engine that allows users to enter a Boolean search string. I parse it in PHP and send it to MySQL MATCH() AGAINST('' IN BOOLEAN MODE). Everything works great except for when a user enters the search string: C++

MySQL returns results (I should probably mention that ft_min_word_len=1 for my installation) but they are not correct. Nowhere in the documentation does it mention how to get MySQL to index special characters or to allow Boolean searching over special characters. I do not want to use LIKE or REGEXP to try to find these words especially since many users have C++ mixed into a full Boolean string, Eg. (C++ AND PHP) or (Java AND Oracle), and it would be difficult, if not impossible, to properly connect the BOOLEAN MODE with the LIKE or REGEXP. I have already tried escaping the plus signs with single and double backslashes. I get the same result set - which is wrong.

MATCH(...) AGAINST ('C++' IN BOOLEAN MODE)
MATCH(...) AGAINST ('"C++"' IN BOOLEAN MODE)
MATCH(...) AGAINST ('C\+\+' IN BOOLEAN MODE)
MATCH(...) AGAINST ('C\\+\\+' IN BOOLEAN MODE)
MATCH(...) AGAINST ('C+z+' IN BOOLEAN MODE) [yes, the z is supposed to be there]
All return the same incorrect result set.

Basically, my question is this: How do you get MySQL to index special characters and allow for BOOLEAN MODE searching of words/acronyms/etc with those special characters. Having this documented would probably save many hours for many developers.

Options: ReplyQuote


Subject
Views
Written By
Posted
Special Characters in Boolean Searching
6607
December 19, 2005 08:48AM


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.