Bug #361 Bug with optimizer and fulltext search using wildchar
Description:
Fulltext search seems to not work properly with wildchar, depending whether a condition on another column of the table is used or not. (ft_stopword_file is /dev/null ;))
How to repeat:
Download tables at : ftp://support.mysql.com/pub/mysql/secret/bugfulltext.tar.gz
SELECT produits.categorie,produits.id_produit,produits.nom,categories.nom_cat FROM produits,stocks,categories WHERE produits.categorie='10' AND produits.categorie=categories.id_cat AND produits.id_produit=stocks.id_produit AND stocks.maj=1 AND (MATCH (categories.nom_cat) AGAINST ('imprimante*' IN BOOLEAN MODE)) GROUP BY id_produit;
+-----------+------------+---------------------------+-------------+
| categorie | id_produit | nom | nom_cat |
+-----------+------------+---------------------------+-------------+
| 10 | 895 | Stylus C60 (C11C418041HA) | Imprimantes |
+-----------+------------+---------------------------+-------------+
1 row in set (0.00 sec)
=> This should return more results.
Then I try with "imprimantes" instead of "imprimante*" :
SELECT produits.categorie,produits.id_produit,produits.nom,categories.nom_cat FROM produits,stocks,categories WHERE produits.categorie='10' AND produits.categorie=categories.id_cat AND produits.id_produit=stocks.id_produit AND stocks.maj=1 AND (MATCH (categories.nom_cat) AGAINST ('imprimantes' IN BOOLEAN MODE)) GROUP BY id_produit ;
+-----------+------------+------------------------------------------+-------------+
| categorie | id_produit | nom | nom_cat |
+-----------+------------+------------------------------------------+-------------+
| 10 | 316 | Photosmart 1115 | Imprimantes |
| 10 | 843 | HL-1230 | Imprimantes |
| 10 | 845 | HL-1440 | Imprimantes |
| 10 | 846 | HL-1450/LT | Imprimantes |
| 10 | 847 | HL-1470N | Imprimantes |
| 10 | 848 | HL-P2500 | Imprimantes |
| 10 | 849 | HL-1650 | Imprimantes |
<cut>
| 10 | 11390 | Stylus Photo 830U (C11C525051) | Imprimantes |
+-----------+------------+------------------------------------------+-------------+
258 rows in set (0.11 sec)
If I remove the produits.categorie='10' condition for the first query, the fulltext search seems to work properly :
SELECT produits.id_produit,produits.nom,categories.nom_cat FROM produits,stocks,categories WHERE produits.categorie=categories.id_cat AND produits.id_produit=stocks.id_produit AND stocks.maj=1 AND (MATCH (categories.nom_cat) AGAINST ('imprimante*' IN BOOLEAN MODE)) GROUP BY id_produit ;
+------------+------------------------------------------+----------------------------+
| id_produit | nom | nom_cat |
+------------+------------------------------------------+----------------------------+
| 316 | Photosmart 1115 | Imprimantes |
| 843 | HL-1230 | Imprimantes |
<cut>
| 11091 | X5190 Pro | Imprimantes multifonctions |
| 11277 | Stylus C42 + Epson Perfection 660 | Imprimantes |
| 11356 | i6500 | Imprimantes |
| 11373 | LaserJet 1300N | Imprimantes |
| 11390 | Stylus Photo 830U (C11C525051) | Imprimantes |
+------------+------------------------------------------+----------------------------+
301 rows in set (0.07 sec)
I don't know if this is related but I also have a different behaviour with the following query :
SELECT produits.categorie,produits.id_produit,produits.nom,categories.nom_cat FROM produits,stocks,categories WHERE produits.categorie='10' AND produits.categorie=categories.id_cat AND produits.id_produit=stocks.id_produit AND stocks.maj=1 AND (MATCH (categories.nom_cat) AGAINST ('"imprimante"*' IN BOOLEAN MODE)) GROUP BY id_produit ;
Empty set (0.04 sec)
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.