The sort order in the OPAC is year (008) and then biblionumber (ASC). This means that in a result list with more than one title matching the first sort criterion, the earlier entries usually appear before the more recent ones. (Exceptions are possible, of course, if a title from an earlier publication year is catalogued after titles published later). The criteria for the first sorting level are configurable in the system preferences OPACdefaultSortField and OPACdefaultSortOrder. Currently there seems to be no way to configure the 2nd sorting level. Not sure whether this is a Zebra only issue. Suggestion: Add system parameter to configure the second sorting level, similar to those for the 1st level mentioned above. Alternatively: sorting by biblionumber on the 2nd level should be descending instead of ascending so newer (more recently catalogued) titles appear before older ones. Steps to Reproduce: Prerequisites: - A Koha OPAC (perhaps Zebra is required?) - First sort criterion must be functional, so if it is the publication year, the year must be present in positions 7-10 in the 008 field of the records. To reproduce: - Search for something with more than one result matching the first sort criterion, e.g. search for all titles published in a specific year. Actual Result: - In the results list the titles from the same year appear in ascending order of their biblionumbers. Expected Results: - Either: the titles appear in descending order of biblionumber - Or: the second sorting level (criterion and asc/desc order) is configurable in additional system parameters similar to OPACdefaultSortField and OPACdefaultSortOrder.
David, adding you as our Zebra expert. I have been looking into turning the biblionumber sorting around some while ago but never got somehwere with it (or figured out where that is set). Do you know how/where the second criteria for sorting comes to be and if it could be reversed?
(In reply to Katrin Fischer from comment #1) > David, adding you as our Zebra expert. I have been looking into turning the > biblionumber sorting around some while ago but never got somehwere with it > (or figured out where that is set). Do you know how/where the second > criteria for sorting comes to be and if it could be reversed? By default, Zebra sorts by internal record number ascending. We use the biblionumber as Zebra's internal record number, so that's why that gets used for that second level sorting. In C4::Search::getRecords(), we define a sort spec which gets handed to the "sort" method of ZOOM::ResultSet. That sort spec originates from either the "sort_by" parameter in the URL or OPACdefaultSortField and OPACdefaultSortOrder sysprefs (this is set up in opac-search.pl or the staff interface search script). You can play with this using URLs like the following: http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=kw&q=test&sort_by=author_az&sort_by=title_za http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=kw&q=test&sort_by=author_az&sort_by=title_az -- So a 2nd system preference could be used and/or a second level search box could be added to the results. There's certainly options there, and it wouldn't require too big of a patch to introduce. It's probably not something I'd personally work on, but I could review someone else's work on it.