[Bug 5864] New: Is C4::Serials::GetSubscriptions searching too generally?
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Bug #: 5864 Summary: Is C4::Serials::GetSubscriptions searching too generally? Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Platform: All OS/Version: All Status: NEW Severity: minor Priority: P5 Component: OPAC AssignedTo: oleonard@myacpl.org ReportedBy: magnus@enger.priv.no QAContact: koha-bugs@lists.koha-community.org After migrating subscription data from 2.2.9 to 3.2.1, 6 of about 222 subscriptions were showing two or three lists of "latest issues", lets say "Journal A" was displaying the list of "latest issues" for "Journal A", but also for "Journal X" and "Journal Y". The first theory was that an incorrect biblionumber had been put in e.g. the subscriptions table (they had to be updated since the biblionumbers changed from the old to the new database), but scrutiny of the data showed this not to be the case. "Jounal X" and "Journal Y" were displaying just fine on their own (looking up the biblionumber showed the expected results). The problem was solved by changing line 104 of opac/opac-detail.pl from this: my @subscriptions = GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber ); to this: my @subscriptions = GetSubscriptions( '', $dat->{issn}, $biblionumber ); preventing C4::Serials::GetSubscriptions from using the title of the journal for finding subscription information. Looking at the code in C4::Serials::GetSubscriptions it looks like, if a title is provided, the function will look for it in all of these fields: biblio.title subscription.callnumber subscription.location subscription.notes subscription.internalnotes returning any subscriptions where the title is found, including any where the string occurs in notes subscription.notes and subscription.internalnotes! This was indeed the case for our original problem, the journal that was displaying extra lists of issues was "Science" ("Journal A"), and the two extra journals having their issues erroneously displayed ("Journal X" and "Journal Y") had the word "science" mentioned in the subscription.notes field. Changing the call to GetSubscriptions worked in this case, but I'm not sure it would be an improvement for everyone? This was tested with 3.2.1, but the code seems to be same in master. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.poulain@biblibre.com --- Comment #1 from Paul Poulain <paul.poulain@biblibre.com> 2011-03-14 14:02:24 UTC --- Hi Magnus, we already have fixed the problem (but not submitted it upstream, our fault...) See: http://git.biblibre.com/?p=koha;a=commit;h=80ba3e785101204419922d810b7a0cd3d... -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 --- Comment #2 from Magnus Enger <magnus@enger.priv.no> 2011-03-14 15:07:07 UTC --- Cool, I'll just leave the bug report as it is then, so you have a bug number for your patch... ;-) -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|oleonard@myacpl.org |julian.maurice@biblibre.com --- Comment #3 from Julian Maurice <julian.maurice@biblibre.com> 2011-03-15 08:18:24 UTC --- Created attachment 3299 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=3299 Patch from BibLibre -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 |PATCH-Sent Patch Status|--- |Needs Signoff -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Nicole C. Engard <nengard@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nengard@gmail.com Patch Status|Needs Signoff |Signed Off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz Patch Status|Signed Off |Needs Signoff -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Magnus Enger <magnus@enger.priv.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Needs Signoff |Signed Off --- Comment #4 from Magnus Enger <magnus@enger.priv.no> 2011-03-18 09:51:00 UTC --- Tested on current master. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Signed Off |Patch Pushed --- Comment #5 from Chris Cormack <chris@bigballofwax.co.nz> 2011-03-20 23:01:19 UTC --- Pushed and merged, please test and mark resolved -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Magnus Enger <magnus@enger.priv.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #6 from Magnus Enger <magnus@enger.priv.no> 2011-03-21 22:02:23 UTC --- Works in current master. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 Frédérick Capovilla <fcapovilla@live.ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fcapovilla@live.ca --- Comment #7 from Frédérick Capovilla <fcapovilla@live.ca> 2011-05-20 19:54:18 UTC --- Comment on this problem : The patch that was pushed fixes this particular problem by passing less filters to the GetSubscriptions() subroutine, but it doesn't fix the main problem : GetSubscriptions() is still searching too generally. I tried printing the final query created by GetSubscriptions and here is what it looks like : SELECT subscription.*, subscriptionhistory.*, biblio.title,biblioitems.issn,biblio.biblionumber FROM subscription LEFT JOIN subscriptionhistory USING(subscriptionid) LEFT JOIN biblio ON biblio.biblionumber = subscription.biblionumber LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber WHERE biblio.biblionumber=? AND (biblio.title LIKE ? ) OR (subscription.callnumber LIKE ? ) OR (subscription.location LIKE ? ) OR (subscription.notes LIKE ? ) OR (subscription.internalnotes LIKE ? ) AND (biblioitems.issn LIKE ? ) OR (subscription.callnumber LIKE ? ) ORDER BY title Example binds used : "47569" "%M%" "%M%" "%M%" "%M%" "%M%" "%1715-4820%" "%1715-4820%" I think the query generated by GetSubscriptions needs to be fixed too... -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 --- Comment #8 from Paul Poulain <paul.poulain@biblibre.com> 2011-05-22 19:52:21 UTC --- The fix does what it intended to do: when you want to find a subscription from biblionumber, it's an "exact" search. The other parameter is for a kind of "approximative" search. Should it search on callnumber or not ? on title or not ? with % or not ? I think it's another debate. Our libraries usually don't complain when there is a little bit too many results, they understand that the search is "large". A fix could be to have the search explicitely done on "title", "callnumber", ... But that would require the user form to have more fields available (atm, there is only one field). I' not sure i've an opinion wether it's a good idea or not. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5864 --- Comment #9 from Frédérick Capovilla <fcapovilla@live.ca> 2011-05-31 15:45:30 UTC --- Here is the comment of this subroutine : this function gets all subscriptions which have title like $title,ISSN like $ISSN and biblionumber like $biblionumber. With this description, I thought that the subroutines would return all subscriptions with the specified title AND ISSN AND biblionumber. Right now, it doesn't exactly returns that because the ANDs and ORs of the query are all mixed together without useful parentheses. If I'm not wrong, with MySQL's operator precedences, the current query looks like this : (biblio.biblionumber=? AND biblio.title LIKE ? ) OR subscription.callnumber LIKE ? OR subscription.location LIKE ? OR subscription.notes LIKE ? OR (subscription.internalnotes LIKE ? AND biblioitems.issn LIKE ? ) OR subscription.callnumber LIKE ? I think it was meant to be like this : (biblio.biblionumber=?) AND (biblio.title LIKE ? OR subscription.callnumber LIKE ? OR subscription.location LIKE ? OR subscription.notes LIKE ? OR subscription.internalnotes LIKE ?) AND (biblioitems.issn LIKE ? OR subscription.callnumber LIKE ?) I understand that the current fix does solve the problem, but I just want to bring to someone's attention that the GetSubscriptions subroutine might not work as intended. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org