Reputation: 11328
I want to search the database using mysql's fulltext index using multiple search terms:
SELECT description FROM `products` WHERE match(name, description) against('*ana* *apple*' IN BOOLEAN MODE)
I want the above query to return the following records, but it wont work:
babana pie
applet
fried bananas
juicy apples
Is my query ok?
Upvotes: 0
Views: 1500
Reputation: 1
You will get only apple related Records this is because wildcard at before a word
(eg:*ana)
and for a phrase
(eg:"apple ban"*)
is not supported in MySQL FTS.It will be simply ignored if wildcard is given before a word and for the phrase case error will be returned.
Upvotes: 0
Reputation: 360672
You may be running into the fulltext's restriction that words appearing in more than a set % of the records are considered "noise" and ignored. Both 'banana' and 'apple' appear in 50% of your sample records, so are most likely not good matches. Try adding some other fruits into your test data and search for something that's more "rare".
Upvotes: 1