@@ -, +, @@ --- 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(-) --- a/C4/Search.pm +++ a/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; } --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ a/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 ) ); --- a/admin/searchengine/elasticsearch/mappings.yaml +++ a/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: --- a/etc/zebradb/ccl.properties +++ a/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, --- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml +++ a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml @@ -9,6 +9,9 @@ Local-number:n + + Local-number:s + Identifier-standard:w --- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl +++ a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl @@ -51,6 +51,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + --- a/installer/data/mysql/atomicupdate/bug_30327_add_sortComponents_syspref.pl +++ a/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"; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/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: --