List words indexed by Innodb fulltext

跟風遠走 提交于 2020-01-15 05:18:08

问题


In Mysql (Innodb) I have created a FULL-TEXT index.

Is there a query I can use to retrieve a list of all words contained in the full-text index?

My idea is to use a text field that hold a json dump of a list of TAGS.

Than I can use full-text query to retrieve rows matching tags (it works).

The problem left is to retrieve a list of indexed tags to implement a suggestion and auto completion tag input field.


回答1:


Set innodb_ft_aux_table mysql server variable at runtime to your innodb table containing the fulltext index. This will cause the INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE to be populated. This table contains a word column containing

word extracted from the text of the columns that are part of a FULLTEXT

You can use select query to ge the list of words from this table. However, this setting is recommended for testing / debugging purposes only, so I would not really use it in a live environmnet.

Another catch with this approach is the minimum length of words being indexed and the stopword list. If a tag is shorter than the minimum word length, it is not going to be indexed. If the tag name is on the stopword list, it will not be indexed.

To be honest, I would rather create a separate table where you maintain the list of tags and would use that as a source for the auto complete.



来源:https://stackoverflow.com/questions/34945523/list-words-indexed-by-innodb-fulltext

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