简体   繁体   English

MySQL MATCH AGAINST不会返回所有拟合结果

[英]MySQL MATCH AGAINST doesn't return all fitting results

I have a table of, to simplify , photo ids and tag ids . 为了简化起见 ,我有一张桌子的照片ID标签ID And I noticed recently that when I use the MATCH AGAINST command it doesn't return all the suitable matches. 而且最近我注意到,当我使用MATCH AGAINST命令时,它不会返回所有合适的匹配项。 Even though sometimes two rows contain the exact same text that's been tested against, but still one gets selected and the other doesn't. 即使有时两行包含经过测试的完全相同的文本,但是仍然选择了其中一行,而另一行则没有。

Here's the table called photos 这是被称为照片的桌子

  id             | type | size    | tag                                                                  |
+----------------+------+---------+----------------------------------------------------------------------+
| IMG_1485197299 | jpg  | 1400000 | ImgTg_0000000000                                                     |
| IMG_1485429476 | jpg  |       0 | ImgTg_1485195510 ImgTg_1485195592 ImgTg_1485195621 ImgTg_1486234725  |
| IMG_1485429627 | jpg  |       0 | ImgTg_1485195510 ImgTg_1485195621 ImgTg_1485195592                   |
| IMG_1485429660 | jpg  |       0 | ImgTg_1485195510 ImgTg_1485195621 ImgTg_1485195592                   |
| IMG_1485429669 | jpg  |       0 | ImgTg_1485195510 ImgTg_1485195621 ImgTg_1485195592                   |
| IMG_1485429681 | jpg  |       0 | ImgTg_1485195592                                                     |
| IMG_1485429687 | jpg  |       0 | ImgTg_1486234725                                                     |
| IMG_1485429695 | jpg  |       0 | ImgTg_1485195621 ImgTg_1485195510                                    |
| IMG_1485429704 | jpg  |       0 | ImgTg_0000000000 ImgTg_1486234725                                    |
| IMG_1485429710 | jpg  |       0 | ImgTg_1485195510                                                     |
| IMG_1485429718 | jpg  |       0 | ImgTg_1485195510                                                     |
| IMG_1485433986 | jpg  |       0 | ImgTg_1485195510 ImgTg_1485195592                                    |
| IMG_1485433993 | jpg  |       0 | ImgTg_1485195510 ImgTg_1485195592                                    |
| IMG_1486234762 | png  |  143306 | ImgTg_1486234725                                                     |

This is the command I'm using: 这是我正在使用的命令:

SELECT * FROM photos WHERE MATCH(tag) AGAINST('+ImgTg_1486234725 ' IN BOOLEAN MODE);

and its working fine with most of the table but for some reason it just doesn't work especially on the last row. 并且它在大多数表上都可以正常工作,但是由于某种原因,它尤其在最后一行上不起作用。 Returning: 返回:

+----------------+------+------+-------------------+
| id             | type | size | tag               |
+----------------+------+------+-------------------+
| IMG_1485429687 | jpg  |    0 | ImgTg_1486234725  |
+----------------+------+------+-------------------+

NOTE: If I try and change the tag to a different id it works! 注意:如果我尝试将tag更改为其他id则可以使用! But some ids just don't work 但是有些ids根本不起作用

What should I do? 我该怎么办?

Thank you all for trying to help I've been trying to solve this riddle since yesterday, but I just found the mistake I made after I posted the question :D 谢谢大家从昨天开始一直努力解决的难题,但是我发现问题后才发现错误:D

I was using some kind of latin collation and I changed it to utf8_bin and now it works perfectly! 我使用了某种latin排序规则,将其更改为utf8_bin ,现在可以正常使用了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM