From a29fc6bab9384c71e2aa3c95f9a0e52bd41909a4 Mon Sep 17 00:00:00 2001 From: Jan Kissig Date: Fri, 23 May 2025 11:29:12 +0000 Subject: [PATCH] Bug 39287: Improve "Show volume" search with a more specialized search index The former implementation of "show volume" is relying on an index called rcn which is fed with every 7xx$w and 8xx$w subfield and therefore also shows predecessors and successors to the title. This patch adds a new index only consisting of 773, 800, 810, 811 and 830 $w subfields called rcn-volumes. This index is then used to display the "Show volumes" button and used to limit the results to volumes only. Test plan: 0) set system preference UseControlNumber to Use a) import bug_39287.xml from the attachements f.e. via More -> Cataloging -> Stage records for import Format is MARCXML b) After import search for "main" and open the record with "Main title" c) Click on Show volumes d) recognize search string is "rcn:cnmain NOT (bib-level:a OR bib-level:b)" and 4 results are found e) apply patch f) copy the necessary files to the zebra dirctory sudo cp -i etc/zebradb/biblios/etc/bib1.att /etc/koha/zebradb/biblios/etc/bib1.att sudo cp -i etc/zebradb/ccl.properties /etc/koha/zebradb/ccl.properties sudo cp -i etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl g) restart zebra: sudo koha-zebra --restart kohadev h) rebuild the index: sudo koha-rebuild-zebra -b -f -v kohadev i) restart_all j) redo step b) to d) k) recognize search string is now 'rcn-volumes:cnmain NOT (bib-level:a OR bib-level:b)' and only 2 records (volumes) are found l) sign off --- Koha/Biblio.pm | 6 +++--- etc/zebradb/biblios/etc/bib1.att | 1 + etc/zebradb/ccl.properties | 2 ++ .../marc_defs/marc21/biblios/biblio-koha-indexdefs.xml | 5 +++++ .../marc21/biblios/biblio-zebra-indexdefs.xsl | 10 +++++----- .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 67ea254..1134267 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -1024,13 +1024,13 @@ sub get_volumes_query { if ( !defined($pf003) ) { # search for linking_field$w='Host001' - $searchstr .= "rcn:" . $pf001->data(); + $searchstr .= "rcn-volumes:" . $pf001->data(); } else { $searchstr .= "("; # search for (linking_field$w='Host001' and 003='Host003') or linking_field$w='(Host003)Host001' - $searchstr .= "(rcn:" . $pf001->data() . " AND cni:" . $pf003->data() . ")"; - $searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\""; + $searchstr .= "(rcn-volumes:" . $pf001->data() . " AND cni:" . $pf003->data() . ")"; + $searchstr .= " OR rcn-volumes:\"" . $pf003->data() . " " . $pf001->data() . "\""; $searchstr .= ")"; } diff --git a/etc/zebradb/biblios/etc/bib1.att b/etc/zebradb/biblios/etc/bib1.att index 5689011..2955460 100644 --- a/etc/zebradb/biblios/etc/bib1.att +++ b/etc/zebradb/biblios/etc/bib1.att @@ -174,6 +174,7 @@ att 1094 Identifier-DOI att 1095 language-original att 1096 Title-later att 1097 Multipart-resource-level +att 1098 rcn-volumes att 1185 Performer att 1186 Performer-Individual diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties index a71ea8f..59e6a74 100644 --- a/etc/zebradb/ccl.properties +++ b/etc/zebradb/ccl.properties @@ -1291,3 +1291,5 @@ itg Index-term-genre ln-audio 1=9906 ln-subtitle 1=9907 + +rcn-volumes 1=1098 diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml index e2ab920..8271e57 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml @@ -1013,6 +1013,7 @@ Record-control-number:w + rcn-volumes:w @@ -1093,6 +1094,7 @@ Record-control-number:w + rcn-volumes:w @@ -1118,6 +1120,7 @@ Record-control-number:w + rcn-volumes:w @@ -1152,6 +1155,7 @@ Record-control-number:w + rcn-volumes:w @@ -1163,6 +1167,7 @@ Record-control-number:w + rcn-volumes:w 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 c540d48..bfd0d82 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl @@ -1004,7 +1004,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - + @@ -1140,7 +1140,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - + @@ -1163,7 +1163,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - + @@ -1200,7 +1200,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - + @@ -1209,7 +1209,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl index 70adb5f..c4bab7d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -244,7 +244,7 @@ - /cgi-bin/koha/catalogue/search.pl?q=rcn:+NOT+(bib-level:a+OR+bib-level:b) + /cgi-bin/koha/catalogue/search.pl?q=rcn-volumes:+NOT+(bib-level:a+OR+bib-level:b) /cgi-bin/koha/catalogue/search.pl?q=title-series,phr:""+OR+host-item,phr=""+NOT+(bib-level:a+OR+bib-level:b) -- 2.39.5