Bug 29632: Don't sort cn-sort numerically
When defining our sort fields in we defined all as 'numeric'
For other string containing numbers this is likely correct, however,
for callnumbers it is not. e.g. E45 should sort before E7
This patch adds a new 'callnumber' type and deifnes this for cn-sort and
adds to the field maping a sort without numeric set
To test:
0 - Be using ES with Koha
1 - On records with single item, add callnumbers:
VA65 E7 R63 1984
VA65 E7 T35 1990
VA65 E45 R67 1985
2 - Add public note 'shrimp' or something to make them easily searchable as a group
3 - Search for 'shrimp', sort by callnumber
4 - Note E45 comes last, it should come first
5 - Apply patch
6 - Reset ES mappings
7 - Reindex ES
8 - Repeat search
9 - Sorting should be correct when set to callnumber
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Michal Urban <michalurban177@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b8b8a62f11)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
e64d282b3a
commit
256ef4ee27
|
|
@ -209,6 +209,8 @@ sub get_elasticsearch_mappings {
|
|||
$es_type = 'stdno';
|
||||
} elsif ($type eq 'year') {
|
||||
$es_type = 'year';
|
||||
} elsif ($type eq 'callnumber') {
|
||||
$es_type = 'cn_sort';
|
||||
}
|
||||
|
||||
if ($search) {
|
||||
|
|
|
|||
|
|
@ -71,3 +71,7 @@ sort:
|
|||
type: icu_collation_keyword
|
||||
index: false
|
||||
numeric: true
|
||||
cn_sort:
|
||||
type: icu_collation_keyword
|
||||
index: false
|
||||
numeric: false
|
||||
|
|
|
|||
|
|
@ -1167,7 +1167,7 @@ biblios:
|
|||
marc_type: marc21
|
||||
sort: 1
|
||||
suggestible: ''
|
||||
type: ''
|
||||
type: 'callnumber'
|
||||
cn-suffix:
|
||||
label: cn-suffix
|
||||
mappings:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "29632 ",
|
||||
description => "Add callnumber type to allow sorting",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh, $out) = @$args{qw(dbh out)};
|
||||
$dbh->do(q{
|
||||
ALTER TABLE `search_field` MODIFY COLUMN `type`
|
||||
enum('','string','date','number','boolean','sum','isbn','stdno','year','callnumber') NOT NULL
|
||||
});
|
||||
say $out "Add callnumber to search_field type enum";
|
||||
},
|
||||
};
|
||||
|
|
@ -219,6 +219,11 @@ a.add, a.delete {
|
|||
[% ELSE %]
|
||||
<option value="stdno">Std. Number</option>
|
||||
[% END %]
|
||||
[% IF search_field.type == "callnumber" %]
|
||||
<option value="callnumber" selected="selected">Call Number</option>
|
||||
[% ELSE %]
|
||||
<option value="callnumber">Call Number</option>
|
||||
[% END %]
|
||||
</select>
|
||||
</td>
|
||||
<td data-order="[% search_field.weight | html %]">
|
||||
|
|
|
|||
Loading…
Reference in New Issue