John thegimper wrote:
Ok how can i mix boolean and regexp searches?

SELECT * FROM tbl WHERE MATCH (name) AGAINST ('TEST' IN BOOLEAN MODE) OR name REGEXP 'TEST';

That dont work :(

"That dont work" does not provide any useful information on which to base a reply. We aren't mind readers. If you want help, you need to be specific. Did you get an error message? If so, what was it exactly? Did you get unexpected results? If so, what did you expect, and what did you get?

In any case, your example query is not what Shawn suggested. There is no sense searching for the same word using both the full-text index and a regular expression, and there is no sense joining the conditions with OR when your stated goal is an AND search.

Given a user search string of "Samsung PC LCD monitor", you would separate the words by length, searching the words of length 4 or greater using the full-text index, and the short words via regular expression matching, like this:

  SELECT * FROM tbl
  WHERE MATCH (name) AGAINST ('+Samsung +monitor' IN BOOLEAN MODE)
    AND name REGEXP 'PC'
    AND name REGEXP 'LCD';

Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to