Bugzilla – Attachment 78402 Details for
Bug 18316
Add weighting/relevancy options to ElasticSearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18316: Fix field weight validation/deletion bug
Bug-18316-Fix-field-weight-validationdeletion-bug.patch (text/plain), 2.93 KB, created by
Nick Clemens (kidclamp)
on 2018-09-04 13:35:04 UTC
(
hide
)
Description:
Bug 18316: Fix field weight validation/deletion bug
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-09-04 13:35:04 UTC
Size:
2.93 KB
patch
obsolete
>From f05df6b9b3b759413d3328287746e69a0fd91077 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Fri, 1 Jun 2018 11:39:45 +0200 >Subject: [PATCH] Bug 18316: Fix field weight validation/deletion bug > >--- > admin/searchengine/elasticsearch/mappings.pl | 12 +++++++++++- > .../en/modules/admin/searchengine/elasticsearch/mappings.tt | 4 +++- > 2 files changed, 14 insertions(+), 2 deletions(-) > >diff --git a/admin/searchengine/elasticsearch/mappings.pl b/admin/searchengine/elasticsearch/mappings.pl >index 60ee173..69a4a69 100755 >--- a/admin/searchengine/elasticsearch/mappings.pl >+++ b/admin/searchengine/elasticsearch/mappings.pl >@@ -72,7 +72,17 @@ if ( $op eq 'edit' ) { > my $search_field = Koha::SearchFields->find( { name => $field_name }, { key => 'name' } ); > $search_field->label($field_label); > $search_field->type($field_type); >- $search_field->weight($field_weight) if looks_like_number($field_weight) && $field_weight > 0; >+ >+ if (!length($field_weight)) { >+ $search_field->weight(undef); >+ } >+ elsif ($field_weight <= 0 || !looks_like_number($field_weight)) { >+ push @messages, { type => 'error', code => 'invalid_field_weight', 'weight' => $field_weight }; >+ } >+ else { >+ $search_field->weight($field_weight); >+ } >+ > $search_field->store; > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt >index aea12ca..7cc05da 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt >@@ -80,6 +80,8 @@ a.add, a.delete { > [% CASE 'error_on_delete' %] > An error occurred when deleting the existing mappings. Nothing has been changed! > (search field [% m.values.field_name | html %] with mapping [% m.values.marc_field | html %].) >+ [% CASE 'invalid_field_weight' %] >+ Invalid field weight "[% m.weight | html %]", must be a positive decimal number. > [% CASE 'success_on_update' %] > Mappings updated successfully. > [% CASE 'success_on_reset' %] >@@ -201,7 +203,7 @@ a.add, a.delete { > </td> > <td> > [% IF search_field.mapped_biblios %] >- <input type="number" step="0.01" min="0" max="999" name="search_field_weight" value="[% search_field.weight %]" /> >+ <input type="number" step="0.01" min="0.01" max="999.99" name="search_field_weight" value="[% search_field.weight %]" /> > [% ELSE %] > <input type="hidden" name="search_field_weight" value=""> > [% END %] >-- >2.1.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 18316
:
61472
|
73139
|
73140
|
73492
|
73493
|
73600
|
73601
|
74112
|
74115
|
74116
|
74117
|
74714
|
74720
|
74751
|
74752
|
74753
|
74754
|
75073
|
75074
|
75075
|
75076
|
75458
|
75490
|
75519
|
75520
|
75521
|
75522
|
75523
|
75524
|
75525
|
75526
|
75527
|
75528
|
75529
|
75530
|
75531
|
75536
|
75537
|
75538
|
75539
|
75540
|
75541
|
75699
|
75730
|
77661
|
77662
|
77663
|
77664
|
77665
|
77666
|
77667
|
78396
|
78397
|
78398
|
78399
|
78400
|
78401
|
78402
|
78403
|
80278
|
80335
|
81004
|
81005
|
81006
|
81007
|
81008
|
81009
|
81010
|
81011
|
81012
|
81507
|
81508
|
81509
|
81510
|
81511
|
81512
|
81513
|
81514
|
81515
|
81516
|
82050