Hi!

On Aug 28, Ed Carp wrote:
> How do I do exact phrase matches using FULLTEXT?
> 
> I have this 2 million row table, full of text data, that I want to search
> for an exact phrase.  When I say:
> 
> select * from Laws WHERE MATCH(Line) AGAINST ('MDMA') ORDER BY ID;
> 
> It works correctly, returning 1 row, MUCH faster than doing a "select ...
> LIKE"!
> 
> But when I do:
> 
> select * from Laws WHERE MATCH(Line) AGAINST ('growth hormone') ORDER BY ID;
> 
> MySQL returns every row with either "growth" OR "hormone" in it, which isn't
> what I wanted.  Is there a way to only return the rows where the exact
> phrase "growth hormone" is present?

Try

select * from Laws WHERE MATCH(Line) AGAINST ('growth hormone') AND
Line like '%growth hormone%' ORDER BY ID;

Regards,
Sergei

-- 
MySQL Development Team
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
/_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
       <___/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to