From 230bae0b02875dc25abe8ba71f6e7217fce80b76 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 22 Jun 2022 14:37:23 +0000 Subject: [PATCH] Bug 30879: Add biblionumber as a sorting option in MARC21 This patch updates the Local-Number indexing by adding a zeropad option to Zebra indexing and adding this to the mapping files It also updates C4/Search.pm to allow biblionumber as an option To test: 1 - Apply patches 2 - copy etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl to /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl 3 - Restart all, reindex zebra 4 - Browse to: http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=kw&q=a&sort_by=biblionumber_dsc&count=20 5 - Confirm records sorted correctly 6 - Browse to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=kw&q=a&sort_by=biblionumber_asc&count=20 7 - Confirm records sorted correctly Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- C4/Search.pm | 6 ++++++ .../marc_defs/marc21/biblios/biblio-koha-indexdefs.xml | 2 ++ .../marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl | 9 ++++++++- etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl | 4 ++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index 0ff4d2361e..75da21a4e6 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -390,6 +390,12 @@ sub getRecords { elsif ( $sort eq "title_za" || $sort eq "title_dsc" ) { $sort_by .= "1=4 >i "; } + elsif ( $sort eq "biblionumber_az" || $sort eq "biblionumber_asc" ) { + $sort_by .= "1=12 Local-Number:n Local-Number:w + + Local-Number:s diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl index 626c44c5b3..b3222fadb5 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl @@ -1261,11 +1261,18 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - + + + + + + + + diff --git a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl index f20c48871f..2bdbbf0da6 100644 --- a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl +++ b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl @@ -279,6 +279,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + @@ -302,6 +303,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) ) + + format-number(.,"00000000000") + . -- 2.39.5