List:General Discussion« Previous MessageNext Message »
From:Ed Carp Date:August 28 2001 11:12pm
Subject:RE: FULLTEXT exact match queries?
View as plain text  
> 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;

It works - thanks!  Hmmm...why didn't I think of that? ;)
--
Ed Carp, N7EKG  -  erc@stripped  -  214/341-4420 -
http://www.pobox.com/~erc

Squished Mosquito, Inc.
Internet Applications Development
Escapade Server-Side Scripting Language Development Team
http://www.squishedmosquito.com
Pensacola - Dallas - Dresden - London - Paris

Thread
FULLTEXT exact match queries?Ed Carp29 Aug
  • Re: FULLTEXT exact match queries?Sergei Golubchik29 Aug
    • RE: FULLTEXT exact match queries?Ed Carp29 Aug
Re: FULLTEXT exact match queries?Sergei Golubchik29 Aug