Hi!

On Mar 23, Jessica Svensson wrote:
> Is there any way i can get results with AND instead of OR?
> Trying to search for "black cat" should only return records that contains 
> both black and cat.
> 
> I'm using the following code to get my result:
> 
> SELECT * FROM `searchtbl` WHERE MATCH (text) AGAINST ('black cat' IN 
> BOOLEAN MODE);
> 
> sure there must be an easy way to change the default word separator to AND 
> instead of OR?

There is. See ft_boolean_syntax variable - it defines what characters is
used for each operator. In particular it defines '+' for "must be
present" and a space ' ' for "optionally present" words.

You want to put the space first (for "must be present" words)
 
Regards,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
/_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
       <___/  www.mysql.com

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

Reply via email to