The search function is basically crippled due to poor tokenization and inability to search partial words. For instace, searching for 'drupal' in emails will find drupal@domain.com but not chris@drupal.org. It won't even work for 'drupal.org', and only returns the required results for the cumbersome search string '@drupal.org'. It likewise cannot find partial matches, such as finding 'Chris' in 'Christopher'. The module is nice but limited in use while the search is so restricted.

Comments

pukku’s picture

Assigned: Unassigned » pukku

Hm. The search is really just using the database and issuing a like query — are you using 5.x or 4.7.x?

Ricky

pukku’s picture

Status: Active » Fixed

So, as I was running on the elliptical machine, I suddenly realized that my search strings tend to start with 'r', 'm', 'p'. Your search string starts start with a 'd'. Which led me to realize what the bug is. I've committed the fix to cvs, both for DRUPAL-5 and DRUPAL-4-7, if you want to grab from there. If you're not really interested in updating from CVS, here's what you need to fix:

for DRUPAL-4-7, line 764 reads:
$or_clauses[] = "(cd.$fname like '%$what%')";
this should read:
$or_clauses[] = "(cd.$fname like '%%" . db_escape_string($what) . "%%')";

for DRUPAL-5, line 1330 reads:
$or_clauses[] = "(cd." . site_user_list_escape_column($res['search_column']) . " like '%$what%')";
this should read:
$or_clauses[] = "(cd." . site_user_list_escape_column($res['search_column']) . " like '%%" . db_escape_string($what) . "%%')";

Basically, you need to replace the search string '%$what%' with '%%" . db_escape_string($what) . "%%'.

HTH,
Ricky

pukku’s picture

Hi! Did this solve your problem?

Thanks,
Ricky

cboshuizen’s picture

Bingo! The module just became very useful.

Thank you for such quick support; it is very much appreciated.

Chris

pukku’s picture

Status: Fixed » Closed (fixed)

Cool — I'm glad things are working now.