Hello!

I've configured combine exposed filter to search using "contains" or "contains any word" operator, using patch from here http://drupal.org/node/1782678 , and the search is only case-sensitive

i think it's logical for this filter to be case-insensitive
could someone please help me obtain such functionality

thanks in advance

Files: 

Comments

The search is case insensitive for me. Are you using it on a field of a special type? I tested it on text and text_long.
Tested with Views 7.x-3.x-dev

Thanks

Patch works excellent, also works well for me - regardless of caps or not.

Assigned:Unassigned» Pierre Paul Lefebvre
Status:Active» Postponed (maintainer needs more info)

I would need more info to look more into it. I've assigned the bug to myself and changed the status.
@srgk Even if it is not exactly related to my patch, I have time to look into it.

I am having the same issue using Views 7.x-3.5+17-dev and Drupal 7.15 with MySQL 5.5.21.

It doesn't seem to matter what type of field I'm using the combined filter on. It's always case sensitive no matter what I try.

Well that's how d7 is working, also the normal string filter, like for content: title is simply case-sensitive,
so i don't really see the bug here, it's more like a feature request which would require tons of workarounds.

Status:Postponed (maintainer needs more info)» Active

I still want to look into it. Im surprised it's not case sensitive for me but it is for you guys. I'll test it and confirm the bug tonight.

Thanks

dawehner: I tried making a view with an exposed filter on "Content: Title" and in my tests the filter was not case sensitive. I think it can depend on the database collation and type of database field though:

"The default character set and collation are latin1 and latin1_swedish_ci, so nonbinary string comparisons are case insensitive by default. This means that if you search with col_name LIKE 'a%', you get all column values that start with A or a. To make this search case sensitive, make sure that one of the operands has a case sensitive or binary collation." - http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html

I have the same problem.
My exposed field searches in node title, node body and few taxonomy term reference fields, but the search is only case-sensitive.

mysql is 5.1.63-cll
encoding is UTF-8 Unicode (utf8)
all tables are utf8_general_ci
collation is utf8_general_ci

engine is mysql

the drupal site is in russian, but the search doesn't work as needed with english keywords either

what do i need to change to make the search case-insensitive and how? because right now the results for "Yu" and "yu" differ.
Maybe i can somehow strtolower the keyword and the database record?

please help, i desperately need this

srgk: For me the issue was that one of the fields I was filtering on had the collation utf8_bin.

It seems that if one or more fields that you are filtering on is or gets converted to a binary character set the entire filter becomes case sensitive because you then compare bytes instead of strings. So I changed the field from utf8_bin to utf8_general_ci and then my filter became case-insensitive.

Sergei Golubchik explains it well in his answer in this bug report: http://bugs.mysql.com/bug.php?id=22343

ok guys thank you all

when i transferred the site to a different server the search became case insensitive, i haven't touched anything except export/import the db
so i guess i will never know the truth

Same problem when using a term reference field as one of the filtered fields. I switched it instead to "Taxonomy term: Name", available via a relationship, and that solved the problem.

i'm having the same issue, but with results supplied by module Data (retrives fields from other SQL schemas)

It is also case sensitive for me. Is there a way to change this? Thanks

any movement on this issue?

Same problem. I search in titles, and some text and long-text field, and are sensitive. Suscribe!

This is not a great solution, but it works.
I created a Rule that populates another field on my content type with the names of referenced taxonomy terms when saving the node. Then I expose this field in views filters, rather than try to expose the term name directly in views, which results in duplicate results and this issue with case-sensitivity.

Not a fix, but a workaround that has allowed me to move on.

@dshields @SamuelSolis Could you provide more information on your database? It is currently case insensitive for me so it's pretty hard for me to debug.

Here is some information I would need

If it's a basic install (I'm hoping this is the case) : Operating System + Version

If not :
- DB type (mysql I guess?)
- Database collation and character set

use mysuperDatabase
show variables like "character_set_database";
show variables like "collation_database";

If nothing shows up after this, we will escalate to the table level and see PHP mysql client collation info.

It becomes case sensitive when I add a taxonomy term reference to the group of filters.
If I add a relationship to the term and then add the name of the term to the list of filters, the case sensitivity goes away, but I end up with duplicate results when there are multiple terms selected.

@Pierre Paul Lefebvre

It's a basic install.

This is de SO version:
Linux version 2.6.32-5-amd64 (Debian 2.6.32-48squeeze1) (dannf@debian.org) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Feb 25 00:26:11 UTC 2013

MySQL:
Servidor: Localhost via UNIX socket
Versión del servidor: 5.1.66-0+squeeze1
Versión del protocolo: 10
Juegos de caracteres de MySQL: UTF-8 Unicode (utf8)

Web Server:
Apache/2.2.16 (Debian)
Versión del cliente: 5.1.66
extensión PHP: mysqli

Do you miss anything?

I have the same issue as in #19
The keywords filter becomes case sensitive when I add a taxonomy term reference to the group of filters.

I'm also experiencing this issue, but I don't have a Term in my relationships or filters. I do, however, have a file in my relationships.

Anyone have a fix?

Hey, I've written a little snippet that takes care of this issue for me, this applies to all combine filters site wide to make them case insensitive. It's probably not very clean, but it's something

function hook_views_query_alter(&$view, &$query) {
  // Find all combine fields and make them case insensitive.
  foreach ($query->where as $group_key => $group) {
    foreach ($group['conditions'] as $key => $condition) {
      if(preg_match('/:views_combine/', $condition['field'])) {
        $query->where[$group_key]['conditions'][$key]['field'] = $condition['field'] . ' COLLATE utf8_general_ci';
      }
    }
  }
}

The problem still exists for me too. Combine filter search in text fileds is case-sensitive for all language versions of the site (english too). Is it a way to solve the problem?

I've got this problem, too. I took out all but a simple text field from the combined filter and it's still returning as case-sensitive. I added the hook from #24 and nothing changed. This is really frustrating.

The snippet in comment #24 works perfectly for me, thnx penthehuman.

One rework on this snippet to make it work in combination with dropdown and combine filters:

function hook_views_query_alter(&$view, &$query) {
  // Find all combine fields and make them case insensitive.
  foreach ($query->where as $group_key => $group) {
    foreach ($group['conditions'] as $key => $condition) {
      if (is_string($condition['field']) && (preg_match('/:views_combine/', $condition['field']))) {
        $query->where[$group_key]['conditions'][$key]['field'] = $condition['field'] . ' COLLATE utf8_general_ci';
      }
    }
  }
}

I am in the same place as cadoughe. I added the hook from #24 and tried #27 and still no luck. Does ANYONE know of another way or what I may be doing wrong? I want my combined filters to be case insensative

Issue summary:View changes
StatusFileSize
new861 bytes

The case-(in)sensitive search with the LIKE operator depends on database type and collation.

Not all collations are available on all systems so, I think, a patch involving collation is not appropriate.

LIKE operator are case insensitive by default on MySQL and case sensitive in PostgreSQL and sqlite. This is solved in includes/database/pgsql/database.inc changing LIKE by ILIKE. Some kind of database detection (like in a normal views filter) would be the best to fix this issue. Anyway, the easiest and database compatible solution is transform fields and conditions to lower-case with the lower() function present in MySQL, PostgreSQL and sqlite. The problem is that lower() can't use indexes, making the search a little bit slower.

See attached patch.