开发者

Search mechanism to search for words both with/without special characters - how to?

How to make a search mechanism like that:

when user type: "sól" two words are searched: "sol" & "sól"

开发者_StackOverflow社区

and there are search results for both words


You can use a mySQL collation that is "Umlaut insensitive", for example utf8_general_ci.

Either

  • Create a specialized search column that is utf8_general_ci
  • Or define the collation while searching, which is easier but less good for performance. This should work:

    select * from column where name='sól' COLLATE utf8_general_ci;
    

    However, doing this may degrade performance in some situations, because I'm quite sure the fulltext index can't be used when specifying the collation like this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜