美文网首页
mysql full-text search: fulltext

mysql full-text search: fulltext

作者: BenjaminCool | 来源:发表于2019-01-07 10:57 被阅读13次

http://www.mysqltutorial.org/mysql-full-text-search.aspx
https://dev.mysql.com/doc/refman/5.6/en/innodb-fulltext-index.html

In MySQL version 5.6 or later, only MyISAM and InnoDB storage engines support full-text search.

Defining FULLTEXT Indexes for MySQL Full-Text Searching

CREATE TABLE opening_lines (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
opening_line TEXT(500),
author VARCHAR(200),
title VARCHAR(200),
FULLTEXT idx (opening_line)
) ENGINE=InnoDB;

like operation, regular expression

http://www.mysqltutorial.org/introduction-to-mysql-full-text-search.aspx

MySQL supports text searching by using the LIKE operator and regular expression.

当被搜索的字段其content很大,并且随着行数的增加,麻烦会越来越突出:
性能不高
灵活性不高
匹配度打分不高

解决方案:
FULLTEXT index可以解决搜索问题。

based on pattern: like operation, regular expression

http://www.mysqltutorial.org/mysql-regular-expression-regexp.aspx

http://www.mysqltutorial.org/mysql-like/

based on keyword: FULLTEXT index

相关文章

网友评论

      本文标题:mysql full-text search: fulltext

      本文链接:https://www.haomeiwen.com/subject/kcgyrqtx.html