Home > database >  MySQL full-text index fulltext innodb matching results
MySQL full-text index fulltext innodb matching results

Time:09-24

Has 100000 article data, because the table if you like the query is very slow, the status quo of fulltext but found that can't find the data,
 


The CREATE TABLE ` zb_article ` (
` aid ` int (11), NOT NULL AUTO_INCREMENT,
` title ` varchar (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
` content_text ` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'plain text, without the HTML source code,
PRIMARY KEY (` aid `),
FULLTEXT KEY ` title ` (` title `, ` content_text `)
) ENGINE=InnoDB AUTO_INCREMENT=7578 DEFAULT CHARSET=utf8;


Insert into zb_article values (NULL, 'square project before the PPP project', '(PPP) contract (high-speed). PDF');

# have the results
Select * from zb_article where match (title, content_text) against (' high-speed ');
Select * from zb_article where match (title, content_text) against (' PPP ');


# below is empty
Select * from zb_article where match (title, content_text) against (' contract ');
Select * from zb_article where match (title, content_text) against (' square ');
Select * from zb_article where match (title, content_text) against (' project ');


CodePudding user response:

Mysql does not support Chinese word segmentation, now guess string '(PPP) contract (high-speed). PDF' based on '(' and') 'word, so you first two queries can be as a result,

CodePudding user response:

MYSQL full-text index is not achieve the effect of the like,
A full-text index can only according to the words to query, such as today is Sunday,
Want to check is to check out the results of Sunday, only "today is Sunday,"
There is space or interval of other classes, Sunday is considered a word, can be queried out

CodePudding user response:

The CREATE TABLE ` zb_article ` (
` id ` int (11), NOT NULL AUTO_INCREMENT,
` title ` varchar (200) the DEFAULT NULL,
` body ` text,
PRIMARY KEY (` id `),
FULLTEXT KEY ` title ` (` title `, ` body `)/*! 50100 WITH PARSER ` ngram ` */
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Your query to the results above, you see your relevance, is 0, to use ngram support Chinese
  • Related