| Summary: | ISBN search returns bad results | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Janusz Kaczmarek <januszop> |
| Component: | Searching | Assignee: | Janusz Kaczmarek <januszop> |
| Status: | CLOSED FIXED | QA Contact: | Bugs List <koha-bugs> |
| Severity: | major | ||
| Priority: | P3 | CC: | chris, stephane.delaune |
| Version: | rel_3_2 | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Crowdfunding goal: | 0 |
| Patch complexity: | --- | Documentation contact: | |
| Documentation submission: | Text to go in the release notes: | ||
| Version(s) released in: | Circulation function: | ||
| Attachments: | Proposed patch | ||
Without proposed correction when searching for ISBN / ISSN (nb / ns) -- both using query form and using ccl query -- an incorrect query is sent to the zebra server (there is no @attr 1=7 set -- cf. zebrasrv output). As a result a bad result set is generated. This issue is particularly annoying if (for some reason) the ISSN is entered (also) with dashes and the query is just about a part of ISBN -- then as a result one gets all the records containing the string in question in every possible place, e.g. as a record id or barcode or number of pages etc. Created attachment 3471 [details] [review] Proposed patch This bug is mentioned in: Bug 5555: Corrected search for ISBN / ISSN http://lists.koha-community.org/pipermail/koha-patches/2011-March/014284.html Hi Stephane Is the signed off patch available somewhere, not attached here, and can't see it on the list. Thanks No signed off patch the mail is send, excuse me for forgetting No problem Stephane, I appreciate all the hard work you are all doing Pushed now, please test |
When making ISBN search (having chosen ISBN from the menu, NOT using ccl query) Koha generates fake results - instead of using nb (@attr 1=7) index it looks for given string anywhere in records. This is, most probably, caused by following fragment of C4::Search::buildQuery: # ISBN,ISSN,Standard Number, don't need special treatment elsif ( $index eq 'nb' || $index eq 'ns' ) { $indexes_set++; ( $stemming, $auto_truncation, $weight_fields, $fuzzy_enabled, $remove_stopwords ) = ( 0, 0, 0, 0, 0 ); } Fast workaround could be as attached at the bottom, but maybe somebody would propose a more elegant solution. Best regards, Janusz --- Search.pm 2010-12-30 10:41:23.000000000 +0200 +++ /usr/share/koha/lib/C4/Search.pm 2010-12-30 10:33:35.000000000 +0200 @@ -1125,6 +1129,7 @@ unless ( $indexes_set || !$index || $index =~ /(st-|phr|ext|wrdl)/ ) { $struct_attr = ",wrdl"; } +$indexes_set = 0 if ( $index eq 'nb' || $index eq 'ns' ); # Some helpful index variants my $index_plus = $index . $struct_attr . ':'; @@ -1307,7 +1312,7 @@ # This is flawed , means we can't search anything with : in it # if user wants to do ccl or cql, start the query with that # $query =~ s/:/=/g; - $query =~ s/(?<=(ti|au|pb|su|an|kw|mc)):/=/g; + $query =~ s/(?<=(ti|au|pb|su|an|kw|mc|nb|nc)):/=/g; $query =~ s/(?<=(wrdl)):/=/g; $query =~ s/(?<=(trn|phr)):/=/g; $limit =~ s/:/=/g;