Using a comma when searching for patrons such as "Smith, John" will show no results. However, searching for "Smith John" will pull all related patron records.
I don't think the special character is the issue here - the problem is, that the comma is not part of the data, so you get no match. As we are doing an SQL based search here I am not sure what could be done to make this easily possible - removing the comma or other characters by default might break some searches?
(In reply to Katrin Fischer from comment #1) > As we are doing an > SQL based search here I am not sure what could be done to make this easily > possible - removing the comma or other characters by default might break > some searches? Hmm maybe normalizing the search to remove punctuation isn't a bad idea. I normalize the search for phone number (see bug 23817) although it can actually be fairly difficult to do in the newest versions of Koha because of how we use the REST API for patron search...
This also effects wildcard searches. Previously you could search for a cardnumber like '2913*' and that would return all patrons with cardnumbers starting with '2913'. Now it tries searching for the exact match '2352*' and returns nothing.
(In reply to Lucas Gass from comment #3) > This also effects wildcard searches. Previously you could search for a > cardnumber like '2913*' and that would return all patrons with cardnumbers > starting with '2913'. Now it tries searching for the exact match '2352*' and > returns nothing. I don't think * has worked, but it automatically did a begin with. % should probably still work?
We desperately need this fixed!
(In reply to PPLCS from comment #5) > We desperately need this fixed! Can you explain the problem a bit more as it manifests for you? Has this worked before? I am not aware of it, but not totally user as we had some changes to patron search recently. As I said the problem with comma is that it's not part of the data, it's not failing because of being a special character. If the comma was in your data, you should be able to search for it without issues.
Entering in "Doe, John" in the patron search field worked before the last Koha update. As a librarian I'm hardwired to type in last name first, comma, first name. So this is a real problem when looking up patrons.
(In reply to Katrin Fischer from comment #6) > Has this worked before? Patron searching works correctly in 22.05 with the comma included, so this is a regression.
(In reply to Owen Leonard from comment #8) > (In reply to Katrin Fischer from comment #6) > > > Has this worked before? > > Patron searching works correctly in 22.05 with the comma included, so this > is a regression. Thx for confirming, I already marked it as such and added Joubu in CC.
Created attachment 145054 [details] [review] Bug 32491: Split patron search terms on comma Previous behaviour allowed search 'surname, firstname'. We should remove the comma from the search terms. Test plan: On the main patron search, search for "surname, firstname" and confirm that with this patch applied the search returns the expected results.
(In reply to Owen Leonard from comment #8) > (In reply to Katrin Fischer from comment #6) > > > Has this worked before? > > Patron searching works correctly in 22.05 with the comma included, so this > is a regression. Hum I am expecting a regression caused by 30063 or 30093 and both are in 22.05 Also I see, in 22.05.x includes/patron-search.inc 314 let patterns = pattern.split(' ').filter(function(s){ return s.length }); I haven't tested though.
Created attachment 145058 [details] [review] Bug 32491: Split patron search terms on comma Previous behaviour allowed search 'surname, firstname'. We should remove the comma from the search terms. Test plan: On the main patron search, search for "surname, firstname" and confirm that with this patch applied the search returns the expected results. Signed-off-by: David Nind <david@davidnind.com>
Testing notes (using KTD): 1. For me, this fixes the search from the 'Search for patron' box on the patrons page 2. In the header search it continues to work, however I note that if you search for example for 'burton' then this gives you the autocomplete results. However, if you search for 'Burton,' it doesn't show in autocomplete (but does give you the correct result when you click the button to search). Searching for 'burton mary' will give you the autocomplete results.
In regards to the wild card searches in the patron field, Should this be a separate ticket? Prior to our upgrade to 22.05, we could do searches like 2913*3456 and have it return results. After the upgrade this no longer works. The % wildcard appears to work in the search example above. However the % as a wildcard is odd when compared with how other search indexes work. Most major search engines use either an asterisk or a question mark. The same is true with searching indexes at Ancestry or Family Search. The asterisk replaces multiple characters and the question mark replaces a single character. Most of our staff is accustomed to using an asterisk and trying to adapt to a different nomenclature and keyboard position has proven difficult.
Created attachment 145077 [details] [review] Bug 32491: Split patron search terms on comma - autocomplete
(In reply to David Nind from comment #13) > 2. In the header search it continues to work, however I note that if you > search for example for 'burton' then this gives you the autocomplete > results. However, if you search for 'Burton,' it doesn't show in > autocomplete (but does give you the correct result when you click the button > to search). Searching for 'burton mary' will give you the autocomplete > results. Good catch, that should be fixed here I think. The last patch is fixing it. (In reply to Esther Melander from comment #14) > In regards to the wild card searches in the patron field, Should this be a > separate ticket? Yes, please open a separate bug report.
Created attachment 145078 [details] [review] Bug 32491: Split patron search terms on comma Previous behaviour allowed search 'surname, firstname'. We should remove the comma from the search terms. Test plan: On the main patron search, search for "surname, firstname" and confirm that with this patch applied the search returns the expected results. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 145079 [details] [review] Bug 32491: Split patron search terms on comma - autocomplete Signed-off-by: David Nind <david@davidnind.com>
Created attachment 145083 [details] [review] Bug 32491: Split patron search terms on comma Previous behaviour allowed search 'surname, firstname'. We should remove the comma from the search terms. Test plan: On the main patron search, search for "surname, firstname" and confirm that with this patch applied the search returns the expected results. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 145084 [details] [review] Bug 32491: Split patron search terms on comma - autocomplete Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Pushed to master for 23.05. Nice work everyone, thanks!
Nice work, thanks everyone! Pushed to 22.11.x for the next release.
(In reply to Owen Leonard from comment #8) > (In reply to Katrin Fischer from comment #6) > > > Has this worked before? > > Patron searching works correctly in 22.05 with the comma included, so this > is a regression. I'm running Koha 22.05.07, and this is affecting us. We can't do patron searches with commas or we get no results. I don't know if it was present in previous versions of 22.05 or not.
I have backported the first patch to 22.05.x and that fixes the problem. The 2nd patch is not needed in 22.05.x as 'patron-autocomplete.js' does not exist yet. That would be dependent on Bug 30578.
This one depends on 30063 which is not available on 21.11.x. not backporting.