ignoring mysql fulltext stopwords in query

前端 未结 6 1017
星月不相逢
星月不相逢 2020-12-03 21:38

I\'m building a search for a site, which utilizes a fulltext search. The search itself works great, that\'s not my problem. I string together user provided keywords (MATCH..

6条回答
  •  再見小時候
    2020-12-03 22:29

    setting ft_stopword_file = ""
    didn't work for me, I'm using INNODB tables and MySQL 5.6 (stop words still not indexed in full text indexes after optimizing associated table)

    this solution works (even if you are not super user) :

    CREATE TABLE mydb.stopwordslist(value VARCHAR(20)) ENGINE = INNODB;
    INSERT INTO mydb.stopwordslist(value) VALUES ('skipthisword');
    

    for all users but you still need super user rights :

    SET GLOBAL innodb_ft_server_stopword_table = 'mydb/stopwordslist';
    

    for just the user (assuming it the one who recreating indexes and updating columns)

    SET SESSION innodb_ft_user_stopword_table = 'mydb/stopwordslist';
    

    as it is a session variable, it won't last when your session is closed so please make sure you set it at each session or before you optimize or insert into tables having fulltext index or when you update column indexed by fulltext index

提交回复
热议问题