Bugzilla – Attachment 136255 Details for
Bug 30879
Add option to sort components by biblionumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30879: Add option to sort components by biblionumber
Bug-30879-Add-option-to-sort-components-by-biblion.patch (text/plain), 6.88 KB, created by
Nick Clemens (kidclamp)
on 2022-06-17 11:32:45 UTC
(
hide
)
Description:
Bug 30879: Add option to sort components by biblionumber
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-06-17 11:32:45 UTC
Size:
6.88 KB
patch
obsolete
>From b665f5831c2cbc3d698ad680b0c3af1de38204a3 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 17 Jun 2022 11:28:05 +0000 >Subject: [PATCH] Bug 30879: Add option to sort components by biblionumber > >WIP > >This works for ES, but zebra sorts the biblionumber as a string, s=109 was my attempt based on >https://software.indexdata.com/yaz/doc/tools.html#ccl.syntax >which I don't fully understand >--- > C4/Search.pm | 6 ++++++ > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 1 + > admin/searchengine/elasticsearch/mappings.yaml | 10 +++++----- > etc/zebradb/ccl.properties | 2 +- > .../unimarc/biblios/biblio-koha-indexdefs.xml | 3 +++ > .../unimarc/biblios/biblio-zebra-indexdefs.xsl | 3 +++ > .../bug_30327_add_sortComponents_syspref.pl | 4 ++-- > .../prog/en/modules/admin/preferences/cataloguing.pref | 1 + > 8 files changed, 22 insertions(+), 8 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 1ba56c8384..b682b0a9f7 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 s=109 0 "; >+ } >+ elsif ( $sort eq "biblionumber_za" || $sort eq "biblionumber_dsc" ) { >+ $sort_by .= "1=12 s=109 1 "; >+ } > else { > warn "Ignoring unrecognized sort '$sort' requested" if $sort_by; > } >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index dba475eb3c..38eacf4b34 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -694,6 +694,7 @@ sub _convert_sort_fields { > relevance => undef, # default > title => 'title', > pubdate => 'date-of-publication', >+ biblionumber=> 'local-number', > ); > my %sort_order_convert = > ( qw( desc desc ), qw( dsc desc ), qw( asc asc ), qw( az asc ), qw( za desc ) ); >diff --git a/admin/searchengine/elasticsearch/mappings.yaml b/admin/searchengine/elasticsearch/mappings.yaml >index 28429878f9..54a7cd8fdd 100644 >--- a/admin/searchengine/elasticsearch/mappings.yaml >+++ b/admin/searchengine/elasticsearch/mappings.yaml >@@ -768,14 +768,14 @@ authorities: > - facet: '' > marc_field: 001 > marc_type: marc21 >- sort: ~ >+ sort: 1 > suggestible: '' > - facet: '' > marc_field: 001 > marc_type: unimarc >- sort: ~ >+ sort: 1 > suggestible: '' >- type: string >+ type: number > personal-name: > label: personal-name > mappings: >@@ -2158,12 +2158,12 @@ biblios: > - facet: '' > marc_field: 999c > marc_type: marc21 >- sort: 0 >+ sort: 1 > suggestible: '' > - facet: '' > marc_field: 001 > marc_type: unimarc >- sort: 0 >+ sort: 1 > suggestible: '' > type: string > location: >diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties >index a0f5764d2d..7cb584eb4d 100644 >--- a/etc/zebradb/ccl.properties >+++ b/etc/zebradb/ccl.properties >@@ -326,7 +326,7 @@ lc-card LC-card-number > # system (i.e., any system that > # is not one of the four listed > # above). >-Local-number 1=12 >+Local-number 1=12 s=109 > sn Local-number > > #Date 30 The point of time at which 005, 008/00-05, >diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >index b1f51aa926..a499e4393a 100644 >--- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >+++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >@@ -9,6 +9,9 @@ > <index_control_field tag="001"> > <target_index>Local-number:n</target_index> > </index_control_field> >+ <index_control_field tag="001"> >+ <target_index>Local-number:s</target_index> >+ </index_control_field> > <!--record.abs line 26: melm 009 Identifier-standard:w,Identifier-standard:n--> > <index_control_field tag="009"> > <target_index>Identifier-standard:w</target_index> >diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl >index 1459c293a5..ebfa415456 100644 >--- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl >+++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl >@@ -51,6 +51,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <z:index name="Local-number:n"> > <xslo:value-of select="."/> > </z:index> >+ <z:index name="Local-number:s"> >+ <xslo:value-of select="."/> >+ </z:index> > </xslo:template> > <xslo:template match="marc:controlfield[@tag='009']"> > <z:index name="Identifier-standard:w"> >diff --git a/installer/data/mysql/atomicupdate/bug_30327_add_sortComponents_syspref.pl b/installer/data/mysql/atomicupdate/bug_30327_add_sortComponents_syspref.pl >index 7c64d24c53..ca0ee3b228 100755 >--- a/installer/data/mysql/atomicupdate/bug_30327_add_sortComponents_syspref.pl >+++ b/installer/data/mysql/atomicupdate/bug_30327_add_sortComponents_syspref.pl >@@ -7,8 +7,8 @@ return { > my ($args) = @_; > my ($dbh, $out) = @$args{qw(dbh out)}; > $dbh->do(q{ >- INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >- ('ComponentSortField','title','call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('ComponentSortField','title','call_number|pubdate|acqdate|title|author|biblionumber','Specify the default field used for sorting','Choice'), > ('ComponentSortOrder','asc','asc|dsc|az|za','Specify the default sort order','Choice') > }); > say $out "Added ComponentsSortField and ComponentsSortOrder sysprefs"; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >index 6f66761c37..4aad6fc775 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >@@ -289,6 +289,7 @@ Cataloging: > acqdate: date added > title: title > author: author >+ biblionumber: biblionumber > - ',' > - pref: ComponentSortOrder > choices: >-- >2.30.2
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 30879
:
136255
|
136425
|
136426
|
136427
|
136428
|
136525
|
136526
|
136527
|
136528
|
136545
|
136546
|
136547
|
136548