简体   繁体   English

MySQL全文搜索,无匹配项

[英]MySQL fulltext search with no matches


Having this table: 有此表:

CREATE  TABLE search (
`uid_search` INT(15) NOT NULL auto_increment,
`uid` INT(11), 
`type` VARCHAR(30), 
`strings` TEXT, 
UNIQUE (uid,type),
PRIMARY KEY (uid_search),
FULLTEXT (strings) ) ENGINE=MyISAM 
DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci

And inserting this data: 并插入以下数据:

INSERT INTO `search` (`uid_search`, `uid`, `type`, `strings`) 
VALUES (1, 2, 'doc', 'Formación Primeros Auxilios');

Why none of this queries match the fulltext search? 为什么没有一个查询与全文搜索匹配?

SELECT uid, type, strings, MATCH (strings) AGAINST ('Formación' IN NATURAL LANGUAGE MODE) as matches FROM search

SELECT uid, type, strings, MATCH (strings) AGAINST (CONVERT(_utf8'Formación' USING latin1) IN NATURAL LANGUAGE MODE) as matches FROM agd_tmp.search

I thinks something is wrong with UTF8. 我认为UTF8有问题。

Quoting the manual : 引用手册

In addition, words that are present in 50% or more of the rows are considered common and do not match. 另外,出现在50%或更多行中的单词被认为是通用的,并且不匹配。

You need to insert more rows into your table. 您需要在表中插入更多行。

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

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