Stopwords and MySQL boolean fulltext

僤鯓⒐⒋嵵緔 提交于 2020-01-01 13:19:05

问题


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

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.

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.

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

Thanks in advance for your help,

Travis


回答1:


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.

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

SELECT * FROM table WHERE column REGEXP 'searchterm'

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.




回答2:


Forget it, the change of mysql full-text setting require a restart
details - http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html

note that Dynamic column is marked as NO for ft_stopword_file

However, is no harm to check with your hosting service provider...

If it do restart for you, you can use the following to repair your table full-text

mysql> REPAIR TABLE tbl_name QUICK;


来源:https://stackoverflow.com/questions/4847899/stopwords-and-mysql-boolean-fulltext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!