MySQL全文搜索,包含部分单词

MySQL全文搜索,包含部分单词,sql,mysql,full-text-search,Sql,Mysql,Full Text Search,MySQL全文搜索似乎很棒,是在SQL中搜索的最佳方式。然而,我似乎被困在这样一个事实上:它不会搜索部分单词。例如,如果我有一篇题为“MySQL教程”的文章并搜索“MySQL”,它将找不到它 在做了一些搜索之后,我在MySQL 4中找到了支持这一点的各种引用(我使用的是5.1.40)。我尝试过使用“MySQL”和“%MySQL%”,但都不起作用(我发现的一个链接表明它是stars,但你只能在结尾或开头使用,不能同时使用两者) 这是我的表结构和查询,如果有人能告诉我哪里出了问题,那就太好了。我假设

MySQL全文搜索似乎很棒,是在SQL中搜索的最佳方式。然而,我似乎被困在这样一个事实上:它不会搜索部分单词。例如,如果我有一篇题为“MySQL教程”的文章并搜索“MySQL”,它将找不到它

在做了一些搜索之后,我在MySQL 4中找到了支持这一点的各种引用(我使用的是5.1.40)。我尝试过使用“MySQL”和“%MySQL%”,但都不起作用(我发现的一个链接表明它是stars,但你只能在结尾或开头使用,不能同时使用两者)

这是我的表结构和查询,如果有人能告诉我哪里出了问题,那就太好了。我假设部分单词匹配是以某种方式内置的

CREATE TABLE IF NOT EXISTS `articles` ( `article_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `article_name` varchar(64) NOT NULL, `article_desc` text NOT NULL, `article_link` varchar(128) NOT NULL, `article_hits` int(11) NOT NULL, `article_user_hits` int(7) unsigned NOT NULL DEFAULT '0', `article_guest_hits` int(10) unsigned NOT NULL DEFAULT '0', `article_rating` decimal(4,2) NOT NULL DEFAULT '0.00', `article_site_id` smallint(5) unsigned NOT NULL DEFAULT '0', `article_time_added` int(10) unsigned NOT NULL, `article_discussion_id` smallint(5) unsigned NOT NULL DEFAULT '0', `article_source_type` varchar(12) NOT NULL, `article_source_value` varchar(12) NOT NULL, PRIMARY KEY (`article_id`), FULLTEXT KEY `article_name` (`article_name`,`article_desc`,`article_link`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ; 创建表(如果不存在)`articles`( `article_id`smallint(5)无符号非空自动增量, `条款名称'varchar(64)不为空, `第条说明“文本不为空, `第条链接“varchar(128)不为空, `第11条不为空, `article_user_点击'int(7)unsigned NOT NULL默认值'0', `article_guest_点击'int(10)unsigned NOT NULL默认值'0', `第条评级“十进制(4,2)非空默认值“0.00”, `article_site_id`smallint(5)未签名非空默认值“0”, `第条时间添加了“int(10)无符号非空, `文章\u讨论\u id`smallint(5)无符号非空默认值“0”, `article_source_type`varchar(12)不为空, `article_source_value`varchar(12)不为空, 主键(`article\u id`), 全文键`article\u name`(`article\u name`、`article\u desc`、`article\u link`) )ENGINE=MyISAM默认字符集=utf8自动增量=7; 在“articles”值中插入 (1、‘MySQL教程’、‘Lorem Ipsum’仅仅是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是印刷行业的标准虚拟文本,当时一家不知名的印刷商拿着一个打字机,争先恐后地制作了一本打字样本书。它不仅存活了五个世纪,而且还跨越到了电子版它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着Aldus PageMaker等桌面出版软件的发布而流行,包括Lorem Ipsum版本http://www.domain.com/', 6, 3, 1, '1.50', 1, 1269702050, 1, '0', '0'), (2)《如何使用MySQL》,“Lorem Ipsum”只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是印刷行业的标准虚拟文本,当时一家不知名的印刷商拿起一个打印工具,将其拼凑成一本字体样本书。它不仅存活了五个世纪,而且还跨越到了electronic排版,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着包括Lorem Ipsum版本的Aldus PageMaker等桌面出版软件的发布而流行http://www.domain.com/', 1, 2, 0, '3.00', 1, 1269702050, 1, '0', '0'), (3,“优化MySQL”,“Lorem Ipsum”只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一家不知名的印刷商拿起一个打印工具,争先恐后地将其制成一本打印样本书。它不仅存活了五个世纪,而且还跨越到了电子版esetting,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着包括Lorem Ipsum版本在内的Aldus PageMaker等桌面出版软件的发布而流行http://www.domain.com/', 0, 1, 0, '3.00', 1, 1269702050, 1, '0', '0'), (4,'1001 MySQL Tricks','Lorem Ipsum仅仅是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是该行业的标准虚拟文本,当时一家不知名的印刷商拿着一个打印工具,争先恐后地制作了一本字体样本书。它不仅存活了五个世纪,而且还跨越到了电子版pesetting,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着包括Lorem Ipsum版本在内的Aldus PageMaker等桌面出版软件的发布而流行http://www.domain.com/', 0, 1, 0, '3.00', 1, 1269702050, 1, '0', '0'), (5,“MySQL vs.YourSQL”,“Lorem Ipsum”只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是该行业的标准虚拟文本,当时一家不知名的印刷商拿起一个打印工具,争先恐后地制作了一本字体样本书。它不仅存活了五个世纪,而且还跨越到了电子版pesetting,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着包括Lorem Ipsum版本在内的Aldus PageMaker等桌面出版软件的发布而流行http://www.domain.com/', 0, 2, 0, '3.00', 1, 1269702050, 1, '0', '0'), (6、‘MySQL安全’、‘Lorem Ipsum’仅仅是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是该行业的标准虚拟文本,当时一家不知名的印刷商拿起一个打印工具,争先恐后地制作了一本打字样本书。它不仅存活了五个世纪,而且还跨越到了电子版它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着Aldus PageMaker等桌面出版软件的发布而流行,包括Lorem Ipsum版本http://www.domain.com/', 0, 2, 0, '3.00', 1, 1269702050, 1, '0', '0'); 从项目a中选择计数(a.article_id) 其中(a.article\u name、a.article\u desc、a.article\u link)与('mysql')匹配 按a.article\u id分组 按a.article\u time\u添加ASC订购 前缀的使用是因为它来自一个有时会添加额外连接的函数 INSERT INTO `articles` VALUES (1, 'MySQL Tutorial', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.', 'http://www.domain.com/', 6, 3, 1, '1.50', 1, 1269702050, 1, '0', '0'), (2, 'How To Use MySQL Well', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.', 'http://www.domain.com/', 1, 2, 0, '3.00', 1, 1269702050, 1, '0', '0'), (3, 'Optimizing MySQL', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.', 'http://www.domain.com/', 0, 1, 0, '3.00', 1, 1269702050, 1, '0', '0'), (4, '1001 MySQL Tricks', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.', 'http://www.domain.com/', 0, 1, 0, '3.00', 1, 1269702050, 1, '0', '0'), (5, 'MySQL vs. YourSQL', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.', 'http://www.domain.com/', 0, 2, 0, '3.00', 1, 1269702050, 1, '0', '0'), (6, 'MySQL Security', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.', 'http://www.domain.com/', 0, 2, 0, '3.00', 1, 1269702050, 1, '0', '0'); SELECT count(a.article_id) FROM articles a WHERE MATCH (a.article_name, a.article_desc, a.article_link) AGAINST ('mysql') GROUP BY a.article_id ORDER BY a.article_time_added ASC