[Koha-bugs] [Bug 21146] Elasticsearch 5.6+ doesn't consider '0' a valid boolean

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Aug 2 15:38:49 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21146

--- Comment #1 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Maybe:

diff --git a/Koha/SearchEngine/Elasticsearch.pm
b/Koha/SearchEngine/Elasticsearch.pm
index 9c114fb060..c7081ee559 100644
--- a/Koha/SearchEngine/Elasticsearch.pm
+++ b/Koha/SearchEngine/Elasticsearch.pm
@@ -308,7 +308,11 @@ sub get_fixer_rules {
                 # boolean gets special handling, basically if it doesn't
exist,
                 # it's added and set to false. Otherwise we can't query it.
                 push @rules,
-                  "unless exists('$name') add_field('$name', 0) end";
+                  "if is_true('$name')
+                     add_field('$name', 'true')
+                   else
+                     add_field('$name', 'false')
+                   end";
             }
             if ($type eq 'sum' ) {
                 push @rules, "sum('$name')";

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list