After performing a search, sorting by popularity is an alphabetical sort instead of a numerical. For example, sorting the values of totalissues 5, 7, 9, 66, 85, 91, 808 will give : 91->9->85->808->7->66->5 The Zebra configuration is the default UNIMARC with : melm 942$0 totalissues:n,totalissues:s I've looked into doc of http://search.cpan.org/~mirk/Net-Z3950-ZOOM/lib/ZOOM.pod#sort%28%29 It seems there is no option for numerical sort.
I wonder which one it maps to: http://www.indexdata.com/yaz/doc/zoom.query.html#zoom-sort-strategy
http://www.indexdata.com/yaz/doc/zoom.resultsets.html#zoom.z3950.resultset.sort http://www.indexdata.com/yaz/doc/yaz-client.html#sortspec Hmmm... There is a problem, isn't there? :)
(In reply to M. Tompsett from comment #2) > http://www.indexdata.com/yaz/doc/zoom.resultsets.html#zoom.z3950.resultset. > sort > > http://www.indexdata.com/yaz/doc/yaz-client.html#sortspec > > Hmmm... There is a problem, isn't there? :) What do you mean ?
Still relevant - Koha 16.05 and 17.11.03 search for a title and apply sort filter Popularity (most to least) - results are sorted by biblionumber ASC
Sorting by biblionumber asc is expected if the popularity values on the records are the same, which could explain. But I think the problem is still real. Not sure if it can't be solved with Zebra tho. Adding Tomas.
I bet its solved with Elasticsearch. Can someone confirm ?
We need to zeropad the popularity like we did for biblionumbers on 30879
Created attachment 141068 [details] [review] Bug 13976: Zeropad populariy for Zebra searching This patch is much eased in testing by bug 31644 which will allow you to modify totalissues field via modification To test: 1 - Create a new template at Tools->Marc modification template 2 - Add action: Copy 999$c to 942$0 3 - Create a report: SELECT biblionuber FROM biblios 4 - Run report, show all, do a batch modification to all records using template above 5 - Search for 'a' (make sure you are using Zebra) 6 - Sort by popularity 7 - Note records are sorted wrong 8 - Apply patch 9 - Copy files: cp /kohadevbox/koha/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml cp /kohadevbox/koha/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl 10 - Restart all, reindex zebra sudo koha-rebuild-zebra -v -f kohadev 11 - Reload search results 12 - Success! Sorted correctly Bonus: Test unimarc - same changes
Created attachment 144115 [details] [review] Bug 13976: Sort popularity numerically in Zebra To test: 1 - Create a new template at Tools->Marc modification template 2 - Add action: Copy 999$c to 942$0 3 - Create a report: SELECT biblionuber FROM biblios 4 - Run report, show all, do a batch modification to all records using template above 5 - Search for 'a' (make sure you are using Zebra) 6 - Sort by popularity 7 - Note records are sorted wrong 8 - Apply patch 9 - Restart all 10 - Reload search results 11 - Success! Sorted correctly
Created attachment 144406 [details] [review] Bug 13976: Sort popularity numerically in Zebra To test: 1 - Create a new template at Tools->Marc modification template 2 - Add action: Copy 999$c to 942$0 3 - Create a report: SELECT biblionuber FROM biblios 4 - Run report, show all, do a batch modification to all records using template above 5 - Search for 'a' (make sure you are using Zebra) 6 - Sort by popularity 7 - Note records are sorted wrong 8 - Apply patch 9 - Restart all 10 - Reload search results 11 - Success! Sorted correctly Signed-off-by: Anke <anke.bruns@gwdg.de>
Note for testers: The aim of the batch modification is to populate the number of totalissues in the biblioitems tab to have some entries there without having to perform manual checkouts; the biblionumber is used to populate this field. This means also that checking if the sorting was correct can be done by just looking at the results' URLs where the biblionumber also appears. Thanks to Victor and his patch testing session!
(In reply to Anke Bruns from comment #11) > Note for testers: The aim of the batch modification is to populate the > number of totalissues in the biblioitems tab to have some entries there > without having to perform manual checkouts; the biblionumber is used to > populate this field. > > This means also that checking if the sorting was correct can be done by just > looking at the results' URLs where the biblionumber also appears. > > Thanks to Victor and his patch testing session! Thanks Anke, and Victor, for explaining the bit I forgot to explain :-)
Hi, Why does patch impact koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl ? For the records here is the Zebra doc in attribute 4 : https://software.indexdata.com/zebra/doc/querymodel-rpn.html#querymodel-bib1-structure
Agreed, there's something off going on here.. looks like a mistake adding the XSML change in this patch?
Created attachment 145963 [details] [review] Bug 13976: Sort popularity numerically in Zebra To test: 1 - Create a new template at Tools->Marc modification template 2 - Add action: Copy 999$c to 942$0 3 - Create a report: SELECT biblionuber FROM biblios 4 - Run report, show all, do a batch modification to all records using template above 5 - Search for 'a' (make sure you are using Zebra) 6 - Sort by popularity 7 - Note records are sorted wrong 8 - Apply patch 9 - Restart all 10 - Reload search results 11 - Success! Sorted correctly Signed-off-by: Anke <anke.bruns@gwdg.de>
(In reply to Martin Renvoize from comment #14) > Agreed, there's something off going on here.. looks like a mistake adding > the XSML change in this patch? Removed those
I think we need a test for this change. (In reply to Nick Clemens from comment #7) > We need to zeropad the popularity like we did for biblionumbers on 30879 Don't we finally need it?
(In reply to Jonathan Druart from comment #17) > I think we need a test for this change. Will try to add one when I get a chance > > (In reply to Nick Clemens from comment #7) > > We need to zeropad the popularity like we did for biblionumbers on 30879 > > Don't we finally need it? David Cook found we could natively sort these in Zebra, no need for the padding
QAing
Not sure whats going on here exactly but I am not getting this to work. Even by updating biblioitems.totalissues and reindexing zebra. Any clue ?
find @attr 1=9013 @attr 4=109 0 THIS WORKS (not-on-loan-count) find @attr 1=9003 @attr 4=109 0 Unsupported Use attribute -- v2 addinfo '9003' @David ?
Mentioning the pref C4::Context->preference('UpdateTotalIssuesOnCirc') would have been helpful too :)
Keeping this blocked for now, will resume. Hoping for feedback btw. Still thinking if the combination of :n and :s that I see on totalissues might be related; e.g. not-onloan-count does not have the :s and works.
(In reply to Marcel de Rooy from comment #20) > Not sure whats going on here exactly but I am not getting this to work. > Even by updating biblioitems.totalissues and reindexing zebra. > Any clue ? Also saved the associated biblio records in the editor. But to no avail.
(In reply to Marcel de Rooy from comment #23) > Keeping this blocked for now, will resume. Hoping for feedback btw. > Still thinking if the combination of :n and :s that I see on totalissues > might be related; e.g. not-onloan-count does not have the :s and works. This is not true. We definitely need the :s for the sorting index. Looks like I got it working after all.
Created attachment 148777 [details] [review] Bug 13976: Sort popularity numerically in Zebra To test: 1 - Create a new template at Tools->Marc modification template 2 - Add action: Copy 999$c to 942$0 3 - Create a report: SELECT biblionuber FROM biblios 4 - Run report, show all, do a batch modification to all records using template above 5 - Search for 'a' (make sure you are using Zebra) 6 - Sort by popularity 7 - Note records are sorted wrong 8 - Apply patch 9 - Restart all 10 - Reload search results 11 - Success! Sorted correctly Signed-off-by: Anke <anke.bruns@gwdg.de> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Please add release notes and make some reference to the UpdateTotalIssuesOnCirc preference ;)
Pushed to master for 23.05. Nice work everyone, thanks!
Really happy to see this one fixed :)
Nice work, thanks everyone! Pushed to 22.11.x for the next release.
Backported to 22.05.x for upcoming 22.05.12
applied to 21.11.x for 21.11.20