问题
I'm using LAMP on my machine and I'm using the functionality of Full-Text search in my website. I don't want to consider the by default list of "Full-Text Stopwords" during the Full-Text search. But I want to give some stopwords manually which must not be considered during Full-Text search. Can anyone tell me how should I achieve this? If you need any further information regarding the issue I can provide you the same. Thanks for understanding my issue.
回答1:
As documented under Fine-Tuning MySQL Full-Text Search:
To override the default stopword list, set the ft_stopword_file system variable. (See Section 5.1.4, “Server System Variables”.) The variable value should be the path name of the file containing the stopword list, or the empty string to disable stopword filtering. The server looks for the file in the data directory unless an absolute path name is given to specify a different directory. After changing the value of this variable or the contents of the stopword file, restart the server and rebuild your
FULLTEXT
indexes.The stopword list is free-form, separating stopwords with any nonalphanumeric character such as newline, space, or comma. Exceptions are the underscore character (“
_
”) and a single apostrophe (“'
”) which are treated as part of a word. The character set of the stopword list is the server's default character set; see Section 10.1.3.1, “Server Character Set and Collation”.
Note that, as described elsewhere on that page, you must set this variable when MySQL starts (e.g. as a command line option, or in the [mysqld]
section of a relevant option file) and must rebuild your fulltext indexes once it has been changed.
来源:https://stackoverflow.com/questions/20561425/how-to-overwrite-the-built-in-stopword-list-by-user-defined-list-for-full-text