Jump to content

Archived

This topic is now archived and is closed to further replies.

bcamp1973

*SOLVED* multi-word string in MATCH AGAINST

Recommended Posts

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...

[code]SELECT recipe_id FROM recipe_ingredients WHERE MATCH(ingredient) AGAINST('Garlic Salt')[/code]

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?

Share this post


Link to post
Share on other sites
[code]
SELECT
recipe_id
FROM
recipe_ingredients
WHERE
MATCH(ingredient) AGAINST('"Garlic Salt"' IN BOOLEAN MODE)
[/code]
http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.