Boolean search with truncated exclutions words don't work for me
When I search for:
SELECT * FROM db.test
WHERE
MATCH(story)AGAINST('(+bananas -banana*)'IN BOOLEAN MODE)
I get rows returned but when I search for
SELECT * FROM db.test
WHERE
MATCH(story)AGAINST('(+bananas -bananas)'IN BOOLEAN MODE)
or
SELECT * FROM db.test
WHERE
MATCH(story)AGAINST('(+bananas -bananas*)'IN BOOLEAN MODE)
I get no result. To 开发者_StackOverflowme it seems like you can´t use * together with the minus sign. Does anybody know if thats the case or if its a setting in MySql.
Kind regards Olle
The table is MYISAM and I have a index on the column story.
The last 2 queries do not give any result because they contain contradicting conditions - story must have the word "bananas" and must not have the word "bananas". This is not possible and hence no results.
However the first query means that "bananas" must be present but no "banana".
Also, you may use * with the minus operator.
Hope this helps.
The solution is to skip the parentheses. If I search for '+bananas -banana*' instead of '(+bananas -banana*)' it works. It took a while to figure out thou.
Cheers
精彩评论