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

christefano - September 23, 2008 - 08:37
Priority:normal» critical

It's taken me two days to figure out that this was the reason my searches weren't working.

#2

christefano - September 23, 2008 - 08:38
Title:case sensitive» searches are case sensitive
Category:feature request» bug report

This is a significant difference from the core search in Drupal, so I'm looking at this as a bug.

#3

justinrandell - September 25, 2008 - 14:18

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, 12

to 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, 12

looks 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

christefano - September 25, 2008 - 19:55
Project:Views Fast Search» Views
Version:5.x-2.0» 5.x-1.x-dev

Here is Justin's fix in patch form. It applies against 5.x-1.x-dev and 5.x-1.6.

AttachmentSize
views_267021.patch 453 bytes

#5

christefano - September 25, 2008 - 19:56
Status:active» needs review

Needs review.

#6

merlinofchaos - September 25, 2008 - 19:57
Status:needs review» fixed

This bug was fixed in -dev ages ago.

#7

christefano - September 26, 2008 - 01:04

That this was fixed "ages ago" makes me want a new release in a big way. Meanwhile, thanks for the info, merlinofchaos.

#8

merlinofchaos - September 26, 2008 - 01:12

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

Anonymous (not verified) - October 10, 2008 - 01:12
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.