Hi!

On Mar 25, Ovanes Manucharyan wrote:
> Hello,
> 
> I am trying to search for 2 words which are close to each other..
> In fact, its a name so  it should either occur as John, Doe or John Doe
> in my fulltext index.. (this particular table is full of emails)
> 
> select id,message_subject from email WHERE
> MATCH(message_body,message_subject) against ("John Doe") limit 10;
> 
> The search returns very unrelated messages... sometimes messages containing
> only
> John, sometimes messages containing only Doe.. 
> 
> Only one of the messages returned contained "John Doe" together.
> 
> Is there a way of telling mysql that these 2 words should occur in close
> proximity to each other.. If not
> what workarounds could I employ to get my search completed?
> 
> Sincerely,
> Ovanes
> 

Here's a workaround:

select id,message_subject from email WHERE
 MATCH(message_body,message_subject) against ("John Doe") 
 and concat(message_body,message_subject) like "%John Doe%";
 limit 10;

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