Bugzilla – Attachment 182765 Details for
Bug 39287
Improve "Show volume" search with a more specialized search index
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39287: Improve "Show volume" search with a more specialized search index
Bug-39287-Improve-Show-volume-search-with-a-more-s.patch (text/plain), 9.46 KB, created by
Jan Kissig
on 2025-05-23 12:24:36 UTC
(
hide
)
Description:
Bug 39287: Improve "Show volume" search with a more specialized search index
Filename:
MIME Type:
Creator:
Jan Kissig
Created:
2025-05-23 12:24:36 UTC
Size:
9.46 KB
patch
obsolete
>From d1402c37bf2f83e97ccd8b9dcf2025ffce3a5b52 Mon Sep 17 00:00:00 2001 >From: Jan Kissig <bibliothek@th-wildau.de> >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.abs line 232: melm 773$w Record-control-number--> > <index_subfields tag="773" subfields="w"> > <target_index>Record-control-number:w</target_index> >+ <target_index>rcn-volumes:w</target_index> > </index_subfields> > <!--record.abs line 233: melm 774$w Record-control-number--> > <index_subfields tag="774" subfields="w"> >@@ -1093,6 +1094,7 @@ > <!--record.abs line 248: melm 800$w Record-control-number--> > <index_subfields tag="800" subfields="w"> > <target_index>Record-control-number:w</target_index> >+ <target_index>rcn-volumes:w</target_index> > </index_subfields> > <!--record.abs line 249: melm 800 Author,Author-name-personal,Name,Personal-name--> > <index_data_field tag="800"> >@@ -1118,6 +1120,7 @@ > <!--record.abs line 252: melm 810$w Record-control-number--> > <index_subfields tag="810" subfields="w"> > <target_index>Record-control-number:w</target_index> >+ <target_index>rcn-volumes:w</target_index> > </index_subfields> > <!--record.abs line 253: melm 810$9 Koha-Auth-Number--> > <index_subfields tag="810" subfields="9"> >@@ -1152,6 +1155,7 @@ > <!--record.abs line 259: melm 811$w Record-control-number--> > <index_subfields tag="811" subfields="w"> > <target_index>Record-control-number:w</target_index> >+ <target_index>rcn-volumes:w</target_index> > </index_subfields> > <!--record.abs line 260: melm 811 Author,Author-name-corporate,Name,Conference-name--> > <index_data_field tag="811"> >@@ -1163,6 +1167,7 @@ > <!--record.abs line 261: melm 830$w Record-control-number--> > <index_subfields tag="830" subfields="w"> > <target_index>Record-control-number:w</target_index> >+ <target_index>rcn-volumes:w</target_index> > </index_subfields> > <!--record.abs line 262: melm 830$9 Koha-Auth-Number--> > <index_subfields tag="830" subfields="9"> >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) > </xslo:for-each> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('w', @code)"> >- <z:index name="Record-control-number:w"> >+ <z:index name="Record-control-number:w rcn-volumes:w"> > <xslo:value-of select="."/> > </z:index> > </xslo:if> >@@ -1140,7 +1140,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </xslo:for-each> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('w', @code)"> >- <z:index name="Record-control-number:w"> >+ <z:index name="Record-control-number:w rcn-volumes:w"> > <xslo:value-of select="."/> > </z:index> > </xslo:if> >@@ -1163,7 +1163,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </xslo:for-each> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('w', @code)"> >- <z:index name="Record-control-number:w"> >+ <z:index name="Record-control-number:w rcn-volumes:w"> > <xslo:value-of select="."/> > </z:index> > </xslo:if> >@@ -1200,7 +1200,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </xslo:for-each> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('w', @code)"> >- <z:index name="Record-control-number:w"> >+ <z:index name="Record-control-number:w rcn-volumes:w"> > <xslo:value-of select="."/> > </z:index> > </xslo:if> >@@ -1209,7 +1209,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xslo:template mode="index_subfields" match="marc:datafield[@tag='830']"> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('w', @code)"> >- <z:index name="Record-control-number:w"> >+ <z:index name="Record-control-number:w rcn-volumes:w"> > <xslo:value-of select="."/> > </z:index> > </xslo:if> >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 @@ > <a> > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]"> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn-volumes:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute> > </xsl:when> > <xsl:otherwise> > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=title-series,phr:"<xsl:value-of select="$title"/>"+OR+host-item,phr="<xsl:value-of select="$title"/>"+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute> >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39287
: 182765 |
182766