2017MySQL Chinese Index Solution Natural Language Processing (N-gram parser)

Source: Internet
Author: User

Problem: MySQL search for a long time is not ideal for Chinese, InnoDB engine support for Fulltext index is a new feature introduced by MySQL5.6, but the word "beginner" in the "I am a junior developer" search is not possible results, because the search is empty glyd participle. Therefore, search tasks can only be done by third-party plug-ins. In MySQL 5.7.6 we can use a new full-text indexing plug-in to process them: N-gram parser.

1 installation environment, it is recommended to use the latest MySQL Https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-winx64.zip

2 ngram_token_size=2 #用中文检索分词插件ngram之前, the size of his participle must be set in the MySQL config file first.

Case of word ' information system ' when set to different values

Ngram_token_size= 1 :  ' faith ' Span class= "Crayon-sy" >,  ",  "system" ,  ngram_token_size=2 : ' information ', ' interest ', ' system ';
ngram_token_size=3 : ' Information Department ', ' system of interest ';
ngram_token_size=4 : ' information Systems ';

    

View the specified full-text index table source (view word breakers only, do not do, do not affect the index)
    

Set global innodb_ft_aux_table= ' db/table '; SELECT * from INFORMATION_SCHEMA. ' Innodb_ft_index_table ';

  

3 Full-Text indexing established

A new

CREATE table Table (   ' id ' int (one) default null,   ' name ' varchar) default NULL,   ' content ' text,   Fulltext key Idx_name (name),   fulltext key idx_content (content) with PARSER ngram) Engine=innodb DEFAULT Charset=utf8 ;

B Modification

  

  

2017MySQL Chinese Index resolution Natural Language processing (N-gram parser)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.