Home > database >  Mysql more field sort search keywords based on matching degree, 20 million data. How to optimize SQL
Mysql more field sort search keywords based on matching degree, 20 million data. How to optimize SQL

Time:09-27

A list of commodity goods, about 20 million data
Goods are field shop_name and goods_name
Now there is a demand, the user to enter search keywords to find, need according to the correlation of the keyword or matching degree sorting
Now keyword with hanlp Chinese word segmentation, and then to look up,
Such as: small raccoon baby powder after word segmentation processing for: baby raccoon powder
Keywords are not fixed to the user input participle

Now the SQL statements for
Select * from goods where concat (shop_name, goods_name) regexp 'baby raccoon | | talcum powder'

Need is: commodity title match at the same time high keyword in front of the store name contains keywords at the top, it needs to be how to write SQL

CodePudding user response:

Fuzzy search seems to use indexes

CodePudding user response:

Do the segmentation, should not use the full text retrieval database? How to directly with regular match again?

CodePudding user response:

You can refer to this

https://blog.csdn.net/u011734144/article/details/52817766

CodePudding user response:

Avoid full text search, for performance reasons,

CodePudding user response:

Atomicity, plus column, and the index
Or, table, 2000 w...

CodePudding user response:

Don't go use a regular index, it is recommended that you use the like, have the index will be a lot faster
  • Related