easyrider
easyrider

Reputation: 701

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"

and there are search results for both words

Upvotes: 0

Views: 104

Answers (1)

Pekka
Pekka

Reputation: 449613

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.

Upvotes: 1

Related Questions