[Bug 33514] New: breaks ISBN search in item search
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Bug ID: 33514 Summary: breaks ISBN search in item search Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Searching Assignee: koha-bugs@lists.koha-community.org Reporter: katrin.fischer@bsz-bw.de QA Contact: testopia@bugs.koha-community.org Depends on: 23919 Item search is SQL based, not search engine based. When bug 23919 added SearchWithISSNVariations to item search, it broke all searches, but for one use case (that was tested): single ISBN, no ISBD punctuation. We are exploding the search now with up to 4 forms of ISBN into something like: isbn like 'isbn1' or isbn like 'isbn2' ... But: We are not truncating. As soon as there is more than one ISBN (this is a repeatable field) or the library actually follows MARC21 standard adding ISBD punctuation, this fails. The data in biblioitems.isbn looks like this: isbn1 ; | isbn2 ; | isbn3. isbn1. This also seems to create quite a performance issue on big databases and it can't be turned off separately from the normal search. I am not sure what is best, we could do something like this, which will make the search work again, but I think we also should make it a separate switch: @@ -1047,7 +1047,12 @@ sub _SearchItems_build_where_fragment { if ( C4::Context->preference("SearchWithISBNVariations") and $query ) { my @isbns = C4::Koha::GetVariationsOfISBN( $query ); $query = []; + foreach my $isbn(@isbns) { + $isbn = "%" . $isbn . "%"; + } Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23919 [Bug 23919] Make ISSN searchable with and without hyphen -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|breaks ISBN search in item |SearchWithISSNVariations |search |breaks ISBN search in item | |search --- Comment #1 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I should also mention that any truncation entered in the item search is lost when it's run through the ISBN conversion. So there is no workaround. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|SearchWithISSNVariations |SearchWithIS[B|S]NVariation |breaks ISBN search in item |s breaks ISBN search in |search |item search -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com, | |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Patrick Robitaille <patrick.robitaille@collecto.ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |patrick.robitaille@collecto | |.ca -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I am not sure what the best solution here is: 1) Remove the ISBN handling from item search. 2) Fix it to search for ISBN left and right truncated (%isbn%) a) create a separate system preference to turn it on/off b) leave it at one system preference as it is now that controls catalog and item search Note: the performance issues I mentioned earlier have been fixed by giving the databaes more resources. 2a? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=33303 CC| |jonathan.druart+koha@gmail. | |com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Katrin Fischer from comment #2)
I am not sure what the best solution here is:
What about making sure that normalized strings are always stored on the DB? (i.e. no spaces, no symbols). It feels like GetVariationsOfISBN might be too much in my opinion. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Tomás Cohen Arazi from comment #3)
(In reply to Katrin Fischer from comment #2)
I am not sure what the best solution here is:
What about making sure that normalized strings are always stored on the DB? (i.e. no spaces, no symbols). It feels like GetVariationsOfISBN might be too much in my opinion.
I think that's not the main issue here, sorting differently would not resolve hte issue. We need to fix the search query. The problem is that we store a string of space separated ISBN and you can't search that with SQL without truncating/using LIKE. And that's what happens now and only works when there is only one ISBN on the record (which often is not the case at least for us) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- sorting => storing
I think that's not the main issue here, storing differently would not resolve hte issue. We need to fix the search query. The problem is that we store a string of space separated ISBN and you can't search that with SQL without truncating/using LIKE. And that's what happens now and only works when there is only one ISBN on the record (which often is not the case at least for us)
-- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |emily.lamancusa@montgomeryc | |ountymd.gov -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |michaela.sieber@kit.edu --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- This is still an issue - I believe we should remove ISBN variations in item search, it can't work as implemented. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33514 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Katrin Fischer from comment #0)
@@ -1047,7 +1047,12 @@ sub _SearchItems_build_where_fragment { if ( C4::Context->preference("SearchWithISBNVariations") and $query ) { my @isbns = C4::Koha::GetVariationsOfISBN( $query ); $query = []; + foreach my $isbn(@isbns) { + $isbn = "%" . $isbn . "%"; + }
IMO this is the correct fix, it's what we do in the 2 other places. C4/Acquisition.pm 2204 if (@isbns) { 2205 $query .= " AND ( biblioitems.isbn LIKE " . join( " OR biblioitems.isbn LIKE ", @isbn_params ) . ")"; 2206 foreach my $isb (@isbns) { 2207 push @query_params, "%$isb%"; 2208 } 2209 } 2107 if ( C4::Context->preference("SearchWithISBNVariations") ) { 2108 @isbns = C4::Koha::GetVariationsOfISBN($isbn); 2109 foreach my $isb (@isbns) { 2110 push @isbn_params, '?'; 2111 } 2112 } C4/Search.pm 1441 if ( C4::Context->preference("SearchWithISBNVariations") ) { 1442 my @isbns = C4::Koha::GetVariationsOfISBN($operand); 1443 $operands[$i] = $operand = '(' . join( ' OR ', map { 'nb=' . $_ } @isbns ) . ')'; 1444 $indexes[$i] = $index = 'kw'; 1445 } 1446 } -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org