简体   繁体   中英

mysql faster way of matching an inner string

I'm trying to match on band names in a DB by excluding 'The'

So a search for 'The Beatles' or 'Beatles' would both succeed.

This is too slow: select * from artists where artist_name LIKE '%beatles';

Better ways to do this? I'd like to avoid having an extra sorting/matching column with 'the' stripped out.

Thanks!

See my presentation Practical Full-Text Search in MySQL that I did for the MySQL University webinar series.

I compare several solutions, including:

  • MySQL FULLTEXT indexing
  • Apache Lucene (though I would recommend checking out Solr)
  • Sphinx Search
  • Inverted indexing
  • Google Custom Search Engine (CSE) and similar search services

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

  • Try a fulltext index to index the artist column
  • Use a external indexing tool like Sphinx . This will add another tool and index, but it is capable of really good and fast searching.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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