Hi!

On Apr 03, Oson, Chris M. wrote:
> Hello,
> 
> I have a site that I'm trying to implement a search engine on existing and 
> archived news stories on a medium text datatype in a database.
> 
> I read the documentation and got it running, but unless I missed something 
> it's not doing what I want it to do.
> 
> For example, if I put in the keywords [Alpine Fire], it will return all 
> stories with Alpine Fire in it.  That is what I want, but if there's 
> another story about a fire, the search will return that also.  Or if 
> there's a story about an incident on Alpine street, that will also 
> be returned.
> 
> What I want is only stories that contain the keywords [Alpine Fire].  Is 
> there a way to do that with a full text search?  I'd rather not have to 
> do a search using [LIKE '%Alpine Fire%'] because that doesn't seem like 
> the most efficient way to do a search.
> 
> chris
> 

Until 4.0 MySQL will have no native support for phrase searching (it's what
you need).

You can work around this with 

SELECT ... WHERE MATCH col AGAINST ('Alpine Fire') and
                col LIKE '%Alpine Fire%'

This should be pretty fast, as the main filtering would be done by MATCH
(be sure to verify this with EXPLAIN, though).

But even without LIKE, stories about 'Alpine Fire' will have higher 
relevance and will be returned first, so simple LIMIT will help to 
distinguish between relevant (about 'Alpine Fire') and not relevant 
(about Alpine street or about a fire) stories.
That's how most search engines work.

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