Bug 4340

Summary: patron name search does not handle punctuated names
Product: Koha Reporter: D Ruth Holloway <ruth>
Component: CirculationAssignee: Guillaume Hatt <guillaume>
Status: CLOSED FIXED QA Contact: Bugs List <koha-bugs>
Severity: normal    
Priority: P5 - low CC: chris, guillaume, jwagner, nengard
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 6253    
Attachments: Patch as sent to koha-patches
Patch minus a typo

Description Chris Cormack 2010-05-21 01:26:01 UTC


---- Reported by dbavousett@ptfs.com 2010-03-24 15:23:05 ----

In C4::Members::SearchMember, the system is searching for surnames like "string%" or "% string%".  Thus, for a search "steuben", you'll get Steuben, Steubenstein, or Von Steuben, but not "D'Steuben" or "Smith-Steuben".

One of our customers would like this to work to find these punctuated names correctly, but merely using LIKE "%string%" is not the answer; in a search for "van", you want to find "Smith-Vandenberg" "Van Smith" or "Vanilla", but not "Sullivan".  

mysql has the capability of doing REGEXP there, but it is very, very slow, but I found a resource describing a method of using a more-general LIKE, then REGEXPing that, which testing indicates is *much* faster than adding a bunch of LIKEs for all the combinations.

Patch coming shortly.



---- Additional Comments From dbavousett@ptfs.com 2010-03-24 16:13:33 ----

Created an attachment
Patch as sent to koha-patches





---- Additional Comments From dbavousett@ptfs.com 2010-03-24 16:39:57 ----

Created an attachment
Patch minus a typo





--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:26 UTC  ---

This bug was previously known as _bug_ 4340 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=4340
Imported an attachment (id=2024)
Imported an attachment (id=2025)

Actual time not defined. Setting to 0.0
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.
CC member jwagner@ptfs.com does not have an account here
The original submitter of attachment 2024 [details] [review] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.
The original submitter of attachment 2025 [details] [review] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.

Comment 1 Owen Leonard 2010-06-29 17:14:41 UTC
Currently the system is successfully returning results for the example here which was failing: A search for "steuben" will return patrons named "Smith-Steuben". However, the system also shows the less desirable behavior described: a search for "van" will return "Sullivan."

I'm tempted to mark this bug fixed since a punctuated name can be searched for successfully. Or should the scope of the bug be changed so that we're talking specifically about the refined LIKE search described above?
Comment 2 D Ruth Holloway 2010-08-13 14:59:40 UTC
This patch *works*, but it's a pact with the Devil.  Once you get a large number of patrons in the database, it's astonishingly inefficient, and thus slows down searches for patrons in an unacceptable way.
Comment 3 Nicole C. Engard 2011-03-07 18:28:29 UTC
Does that mean we should not even test this patch but find a better way to do it?
Comment 4 Chris Cormack 2011-04-08 02:12:27 UTC
Pushed, please test