[Koha-bugs] [Bug 15252] Patron search on start with does not work with several terms
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Nov 25 13:12:04 CET 2015
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15252
--- Comment #1 from Fridolin SOMERS <fridolin.somers at biblibre.com> ---
Created attachment 45131
-->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=45131&action=edit
Bug 15252 - Patron search on start with does not work with several terms
When searching a patron, search type can be 'start with' and 'contain'.
If the search text contains a space (or a coma), this text is splitted into
several terms.
Actually, the search on 'start with' with several terms never returns a result.
It is because the search composes an "AND" SQL query on terms.
For example (I display only the surname part) :
search type = contain :
'jean paul' => surname like '%jean% AND %paul%'
search type = start with :
'jean paul' => surname like 'jean% AND paul%'
The query for 'start with' is impossible.
I propose, for search with start with, to not split terms :
jean paul => surname like 'jean paul%'
One can always use '*' to add more truncation :
jea* pau* => surname like 'jea% pau%'
This bug affects a lot surnames with several terms like 'LE GUELEC' or 'MAC
BETH'.
Note that the patch moves :
$searchmember =~ s/,/ /g;
It removes the test "if $searchmember" because $searchmember is tested and set
to empty string previously :
unless ( $searchmember ) {
$searchmember = $dt_params->{sSearch} // '';
}
Test plan :
==========
- Create two patrons with firstname "Jean Paul"
- Go to Patrons module
- Choose "Starts with" in "Search type" filter
- Perform a search on "Jean Paul"
=> without patch : you get no result
=> with this patch : you get the two results
- Check you get the two results for search on "Jean Pau"
- Check you get the two results for search on "Jea* Pau*"
- Check you do not get results for search on "Jea Paul"
- Choose "Contains" in "Search type" filter
- Check you get the two results for search on "Jean Paul"
- Check you get the two results for search on "Jean Pau"
- Check you get the two results for search on "Jea* Pau*"
- Check you get the two results for search on "Jea Paul"
- Check you get the two results for search on "Paul Jean"
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list