[Koha-bugs] [Bug 29632] New: Callnumber sorting is incorrect in Elasticsearch
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Dec 3 14:48:05 CET 2021
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29632
Bug ID: 29632
Summary: Callnumber sorting is incorrect in Elasticsearch
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: Searching - Elasticsearch
Assignee: koha-bugs at lists.koha-community.org
Reporter: nick at bywatersolutions.com
It looks like we are not sorting cn_sort as a raw field, but sorting the
analyzed version.
To recreate:
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'
4 - Note E45 comes last, it should come first
Problem may be here:
1122 sub _sort_field {
1123 my ($self, $f) = @_;
1124
1125 my $mappings = $self->get_elasticsearch_mappings();
1126 my $textField = defined $mappings->{data}{properties}{$f}{type} &&
$mappings->{data}{properties}{$f}{type} eq 'text';
1127 if (!defined $self->sort_fields()->{$f} || $self->sort_fields()->{$f})
{
1128 $f .= '__sort';
1129 } else {
1130 # We need to add '.raw' to text fields without a sort field,
1131 # otherwise it'll sort based on the tokenised form.
1132 $f .= '.raw' if $textField;
1133 }
1134 return $f;
1135 }
We need to enforce raw for cn-sort, or we need to index it unanalyzed
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
More information about the Koha-bugs
mailing list