简体   繁体   English

mysql更快的匹配内部字符串的方式

[英]mysql faster way of matching an inner string

I'm trying to match on band names in a DB by excluding 'The' 我试图通过排除“The”来匹配数据库中的波段名称

So a search for 'The Beatles' or 'Beatles' would both succeed. 所以搜索“甲壳虫乐队”或“甲壳虫乐队”都会成功。

This is too slow: select * from artists where artist_name LIKE '%beatles'; 这太慢了:从艺术家中选择*,其中artist_name LIKE'%beatles';

Better ways to do this? 更好的方法来做到这一点? I'd like to avoid having an extra sorting/matching column with 'the' stripped out. 我想避免使用'the'剥离的额外排序/匹配列。

Thanks! 谢谢!

See my presentation Practical Full-Text Search in MySQL that I did for the MySQL University webinar series. 请参阅我的演示文稿MySQL中的实用全文搜索 ,我为MySQL大学网络研讨会系列所做的。

I compare several solutions, including: 我比较了几种解决方案,包括:

  • MySQL FULLTEXT indexing MySQL FULLTEXT索引
  • Apache Lucene (though I would recommend checking out Solr) Apache Lucene(虽然我建议查看Solr)
  • Sphinx Search 狮身人面像搜索
  • Inverted indexing 反向索引
  • Google Custom Search Engine (CSE) and similar search services 谷歌自定义搜索引擎(CSE)和类似的搜索服务

应使用全文搜索(FTS)处理文本搜索,使用本机FTS或第三方(IE Sphinx)。

  • Try a fulltext index to index the artist column 尝试使用全文索引来索引艺术家列
  • Use a external indexing tool like Sphinx . 使用像Sphinx这样的外部索引工具。 This will add another tool and index, but it is capable of really good and fast searching. 这将添加另一个工具和索引,但它能够真正快速和快速搜索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM