searches are case sensitive
appel - June 5, 2008 - 12:42
| Project: | Views |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Description
Correct me if I'm wrong, but searching with Views Fastsearch appears to be case sensitive. Shouldn't this be (at least) optional?

#1
It's taken me two days to figure out that this was the reason my searches weren't working.
#2
This is a significant difference from the core search in Drupal, so I'm looking at this as a bug.
#3
this looks like views wasn’t handling the case where a query that had been processed but still contained strings that db_query uses for arg substitution where passed to db_query. this led to unintended substitutions.
for example, views would pass this sql:
SELECT node.nid FROM node node WHERE (UPPER(node.title) LIKE UPPER('%s is not the substitution you were looking for%')) AND (node.type IN ('droids')) AND (node.status = '1') LIMIT 0, 12to db_query, and the '%s' would get replaced with the first element of $args, which if that happened to be node.title, mysql would see:
SELECT node.nid FROM node node WHERE (UPPER(node.title) LIKE UPPER('node.title is not the substitution you were looking for%')) AND (node.type IN ('droids')) AND (node.status = ‘1’) LIMIT 0, 12looks like case sensitive, but isn’t.
a possible fix just converts '%(s|d|f|b)' --> '%%(s|d|b|f)' before the query is passed to db_query by views like this in
views_build_view:<?php$query = preg_replace('/(%(s|d|b|f))/', '%%$2', $query);
?>
#4
Here is Justin's fix in patch form. It applies against 5.x-1.x-dev and 5.x-1.6.
#5
Needs review.
#6
This bug was fixed in -dev ages ago.
#7
That this was fixed "ages ago" makes me want a new release in a big way. Meanwhile, thanks for the info, merlinofchaos.
#8
sun posted an issue with a list of what he wants to do for a 1.7 release. If you'd like to help, see http://drupal.org/node/208855
The list is shockingly long =)
#9
Automatically closed -- issue fixed for two weeks with no activity.