From d1402c37bf2f83e97ccd8b9dcf2025ffce3a5b52 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 487500de110..c956a46f4b6 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -1018,13 +1018,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 5689011c3b2..29554604bff 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 a71ea8f4c40..59e6a74a30a 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 e2ab9205ca0..8271e57b6fc 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 c540d485f3a..bfd0d82b000 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 9167240766c..bd3abe8ae51 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