0

When I use the exposed filter, if I search for "IMAG" all results showing image show up. Is there a way to have the exposed filter search case sensitive?

UPDATE I added a screenshot to explain more. I have tried the operators: is equal to, contains, contains any word, contains all words, and regex. Neither of them are case sensitive.

enter image description here

2
  • Aren't exposed filters case-sensitive by default? What images are you searching for? Is there a way we can reproduce this issue? Can you roughly describe how you've set up your view?
    – leymannx
    Commented Oct 27, 2020 at 14:25
  • I have tried the exposed filters in Drupal 8 and none of them are case sensitive. I am not searching for images. I am searching for the acronym IMAG. To reproduce: 1. Create a view for whichever content(make sure that piece of content has IMAG in the title and another that has the word "image" in the title 2. Add exposed filter for Title 3. Add acronym IMAG to exposed filter. You will notice that it will pull up the node that has the title of "image". I only want it to pull up the node with the title of IMAG. Commented Oct 27, 2020 at 16:04

1 Answer 1

1

For the solution I used the hook_views_query_alter and used the LIKE BINARY operator in my condition.

condition('node_field_data.title', "%{$word}%", 'LIKE BINARY')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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