From 1dabe0deebef291293d6dccaa0e7ba37ec781a0e Mon Sep 17 00:00:00 2001 From: Mariusz Miszuta Date: Sun, 5 Nov 2017 16:00:39 +0100 Subject: [PATCH 1/2] fixed elastic for false values (except null) to be searchable --- src/Connection/ElasticConnection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Connection/ElasticConnection.php b/src/Connection/ElasticConnection.php index dba0f44..58d7583 100755 --- a/src/Connection/ElasticConnection.php +++ b/src/Connection/ElasticConnection.php @@ -429,7 +429,7 @@ private function unsetEmpties(array $haystack) { $haystack[$key] = $this->$selfFn($haystack[$key]); } - if (empty($haystack[$key])) { + if (!isset($haystack[$key])) { unset($haystack[$key]); } } From d2d19480ccbd92280298c983f71a4e0ac9016a00 Mon Sep 17 00:00:00 2001 From: Anderson Date: Mon, 6 Nov 2017 23:31:54 -0300 Subject: [PATCH 2/2] Fixing queries for 0 or any false value comparison The method that remove from DSL query any empty array wasn't considering to remove only ARRAYs. Conditions with empty string, 0 or other false values were been removed, and the condition was being lost. --- src/Connection/ElasticConnection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Connection/ElasticConnection.php b/src/Connection/ElasticConnection.php index 58d7583..314ed2d 100755 --- a/src/Connection/ElasticConnection.php +++ b/src/Connection/ElasticConnection.php @@ -429,7 +429,7 @@ private function unsetEmpties(array $haystack) { $haystack[$key] = $this->$selfFn($haystack[$key]); } - if (!isset($haystack[$key])) { + if (is_array($haystack[$key]) && empty($haystack[$key])) { unset($haystack[$key]); } }