2

From Brad's answer to this question it's obvious that Craft doesn't have a case sensitive search from the start, but he mentions that it depends on MySQL database and table collation.

My question is however related to the way Craft saves keywords in craft_searchindex table. Here they are converted to lowercase. So my question is if there is a way to enable case sensitive search through MySQL collation changes?

My issue is that the client sees an issue when searching for a Persons name in an article content he also finds results which only include words starting the same. However fuzzy search on the right side is needed, so turning it off isn't an option.

2

My answer in that other question was wrong (I've updated it).

As you pointed out, Craft normalizes all search keywords to be lowercase. Case sensitive searches would rely on the database's underlying collation if Craft didn't do that normalization first.

Probably worth adding as a feature request, if you think that shouldn't be the default behavior.

  • In my situation, the Client is complaining about the situation, when they want to search for persons by name (e.g. "Lund") but at the same time they get positive results if there is a word starting like the surname. Partial fuzzy search has to stay enabled. If the keywords wouldn't be normalized, then it would be possible to differentiate Names from other words. However then it would treat first words in the sentence as names. Do you have any ideas for this situation? – pauliusef Nov 15 '16 at 8:17
  • Is the name part of the first name/last name fields in the user account, or are they custom plain text fields. If the latter, you could use the field specific search syntax... i.e. lastName::Lund – Brad Bell Nov 15 '16 at 21:29
  • The problem is that the name is just part of an article, inside a body text field (rich text type). – pauliusef Nov 17 '16 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.