How to search for Soundex() substrings in MySQL?

后端 未结 1 1848
孤城傲影
孤城傲影 2021-01-03 06:43

i got a problem with the Joomla! 3 integrated search engine. This engine\'s indexer creates so called soundex-values when indexing content like, for example

相关标签:
1条回答
  • 2021-01-03 07:17

    You're probably looking to calculate the Levenshtein distance; but if you simply want to find those records that start with something that sounds similar to the search term, you can strip any trailing 0 (which is merely used for padding) and then search for soundex strings with the resulting prefix:

    WHERE t.soundex LIKE CONCAT(TRIM(TRAILING '0' FROM SOUNDEX('test')), '%')
    
    0 讨论(0)
提交回复
热议问题