views:

18

answers:

2

I'm getting results that are hard to understand. I hope that someone will be able to shade some light on the subject.

I have a very simple table in mysql:

id| text
1 | testA testB testC
2 | testA testB

When I run the following query:

SELECT id,  MATCH (text) AGAINST ('+(+testA testB) +testC' IN BOOLEAN MODE) as score FROM test_fulltext 

I get the following incorrect results (note that the second row should return 0)

id| score
1 | 1,1666667461395
2 | 0,66666668653488

However when I run as slightly modified version of the query (no '+' sign before testA):

SELECT id,  MATCH (text) AGAINST ('+(testA testB) +testC' IN BOOLEAN MODE) as score FROM test_fulltext 

I get correct result:

id| score
1 | 1,3333333730698
2 | 0

Do you have any idea why the first query matches the second row? It does that on both mysql 4.1 and 5.0.5.

Do you know where I can find the source code that parses full text queries? Or any other source of information that explains how this is calculated. Any help is welcome.

A: 

You can check out the offical doc :

http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html

Guillaume Lebourgeois
I've read it few times already but thanks!
Piotr Czapla
My apologies !!!
Guillaume Lebourgeois
+1  A: 

It seems that it is a known bug that is present in all versions of mysql. http://bugs.mysql.com/bug.php?id=36384

Piotr Czapla