停用词和MySQL布尔全文 [英] Stopwords and MySQL boolean fulltext

查看:60
本文介绍了停用词和MySQL布尔全文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mysql内置的布尔全文功能搜索数据集. (MATCH ... AGAINST语法).

I'm using mysql's built in boolean fulltext features to search a dataset. (MATCH... AGAINST syntax).

我遇到了一个问题,其中MySql的默认停用词列表中的关键字未返回任何结果.例如,之前",之间"等.

I'm running into a problem where keywords that are in MySql's default stopwords list are not returning any results. For example, "before", "between", etc.

(我认为)无法在运行时禁用MySql的停用词.而且由于我将网站托管在共享服务器(DreamHost)上,因此我无法选择禁用停用词的情况下重新编译MySQL.

There is (I think) no way to disable MySql's stopwords at runtime. And because I am hosting my website on a shared server (DreamHost), I dont have the option of recompiling MySQL with stopwords disabled.

我想知道是否有人对解决上述问题有任何建议? (无需升级到VPS或专用系统)

I'm wondering if anyone has any suggestions on ways around the above problem? (Without upgrading to a VPS or dedicated system)

预先感谢您的帮助,

特拉维斯

推荐答案

我遇到了这个问题,并在此帖子中进行了一次Google搜索(一年后),我也在共享主机上,正在拔头发超过在mysql中设置的停用词.我找到了一种对我来说非常有效的解决方法,希望它也可以对其他人有所帮助.

I had this issue and did a google search coming across this post (over a year later) I am on a shared host as well and was pulling my hair out over the stop words set in mysql. I found a workaround that has been working perfectly for me, hopefully it can be of some use to others as well.

您还可以使用REGEXP命令在表格中匹配搜索词.

You can also use the REGEXP command to match a search term within your table.

SELECT * FROM table WHERE column REGEXP 'searchterm'

我的实现方法是先执行MATCH AGAINST语法,如果count = 0,我将执行REGEXP而不是为用户提供更多结果.由于停用词和最小长度,总比没有结果好.

How I implement it is by first doing the MATCH AGAINST syntax, if the count = 0 I do the REGEXP instead giving my users more results. Better than no results at all due to stop words and minimum lengths.

这篇关于停用词和MySQL布尔全文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆