Jump to content


Photo

*SOLVED* multi-word string in MATCH AGAINST


  • Please log in to reply
2 replies to this topic

#1 bcamp1973

bcamp1973
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 21 August 2006 - 02:45 AM

i'm building a search engine (albiet a very modest one) for a site i'm workign on.  I would like to query a field in the DB for a string contaning multiple words and return results for that string only and not for each instance of the different words in that string.  For example...when i do the following...

SELECT recipe_id FROM recipe_ingredients WHERE MATCH(ingredient) AGAINST('Garlic Salt')

I get a match for all instances of 'Garlic' *and* all instances of 'Salt'...but i only want instances of 'Garlic Salt'. I fear i may have to build a keyword table or something. Any suggestions?

#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 21 August 2006 - 08:45 AM

SELECT 
recipe_id 
FROM 
recipe_ingredients 
WHERE 
MATCH(ingredient) AGAINST('"Garlic Salt"' IN BOOLEAN MODE)
http://dev.mysql.com...ext-search.html

#3 bcamp1973

bcamp1973
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 21 August 2006 - 11:17 PM

Awesome, thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users