Bugzilla – Attachment 69212 Details for
Bug 19563
Generation of sort_fields uses incorrect condition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19563: Generation of sort_fields uses incorrect condition
Bug-19563-Generation-of-sortfields-uses-incorrect-.patch (text/plain), 2.63 KB, created by
David Bourgault
on 2017-11-17 22:17:47 UTC
(
hide
)
Description:
Bug 19563: Generation of sort_fields uses incorrect condition
Filename:
MIME Type:
Creator:
David Bourgault
Created:
2017-11-17 22:17:47 UTC
Size:
2.63 KB
patch
obsolete
>From 1fc641f9b8daf7697fdf389fa68ae85065a94d1a Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Thu, 2 Nov 2017 13:44:13 +0100 >Subject: [PATCH] Bug 19563: Generation of sort_fields uses incorrect condition > >Fix incorrect condition for if clause for generating <field>__sort mappings >for Elasticsearch. Also remove redundant check for same condition when >generating fixer rules. > >Test plan: >1. Inspect current mappings for example by viewing: http://<elasticsearch_host>:9200/koha_<koha_instance_name>_biblios/_mapping. >2. If using the default configuraion only "author" has a sort field (author__sort). >4. Appy patch. >5. Reindex using rebuild_elastic_search.pl. >6. All fields except those with sort sort set to "0" should now have sort fields, which in the default configuration is all but "author". > >Signed-off-by: David Bourgault <david.bourgault@inlibro.com> >--- > Koha/SearchEngine/Elasticsearch.pm | 15 +++++---------- > 1 file changed, 5 insertions(+), 10 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index de4b18c..2b2fd10 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -215,9 +215,10 @@ sub get_elasticsearch_mappings { > search_analyzer => 'simple', > }; > } >- # Sort may be true, false, or undef. Here we care if it's >- # anything other than undef. >- if (defined $sort) { >+ # Sort is a bit special as it can be true, false, undef. >+ # We care about "true" or "undef", >+ # "undef" means to do the default thing, which is make it sortable. >+ if ($sort || !defined $sort) { > $mappings->{data}{properties}{ $name . '__sort' } = { > search_analyzer => "analyser_phrase", > analyzer => "analyser_phrase", >@@ -346,14 +347,8 @@ sub get_fixer_rules { > if ($type eq 'sum' ) { > push @rules, "sum('$name')"; > } >- # Sort is a bit special as it can be true, false, undef. For >- # fixer rules, we care about "true", or "undef" if there is >- # special handling of this field from other one. "undef" means >- # to do the default thing, which is make it sortable. > if ($self->sort_fields()->{$name}) { >- if ($sort || !defined $sort) { >- push @rules, "marc_map('$marc_field','${name}__sort.\$append', $options)"; >- } >+ push @rules, "marc_map('$marc_field','${name}__sort.\$append', $options)"; > } > } > ); >-- >2.7.4
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 19563
:
68889
|
69191
|
69192
|
69212
|
69213
|
69214
|
69640
|
69641
|
69642