From fd71e2554e60ebc4795f4ae08e73ebd37055a8c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simonas=20=C5=A0erlinskas?= <simonas.serlinskas@gmail.com>
Date: Mon, 11 Jul 2016 10:30:34 +0300
Subject: [PATCH] fix bug for functionscore functions filters implementation

---
 src/Query/FunctionScoreQuery.php | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/Query/FunctionScoreQuery.php b/src/Query/FunctionScoreQuery.php
index c5f970c..c154092 100644
--- a/src/Query/FunctionScoreQuery.php
+++ b/src/Query/FunctionScoreQuery.php
@@ -52,15 +52,15 @@ class FunctionScoreQuery implements BuilderInterface
     }
 
     /**
-     * Modifier to apply query to the function score function.
+     * Modifier to apply filter to the function score function.
      *
      * @param array            $function
      * @param BuilderInterface $query
      */
-    private function applyQuery(array &$function, BuilderInterface $query = null)
+    private function applyFilter(array &$function, BuilderInterface $query = null)
     {
         if ($query) {
-            $function['query'] = $query->toArray();
+            $function['filter'] = $query->toArray();
         }
     }
 
@@ -84,7 +84,7 @@ class FunctionScoreQuery implements BuilderInterface
             ],
         ];
 
-        $this->applyQuery($function, $query);
+        $this->applyFilter($function, $query);
 
         $this->functions[] = $function;
 
@@ -116,7 +116,7 @@ class FunctionScoreQuery implements BuilderInterface
             ),
         ];
 
-        $this->applyQuery($function, $query);
+        $this->applyFilter($function, $query);
 
         $this->functions[] = $function;
 
@@ -137,7 +137,7 @@ class FunctionScoreQuery implements BuilderInterface
             'weight' => $weight,
         ];
 
-        $this->applyQuery($function, $query);
+        $this->applyFilter($function, $query);
 
         $this->functions[] = $function;
 
@@ -158,7 +158,7 @@ class FunctionScoreQuery implements BuilderInterface
             'random_score' => $seed ? [ 'seed' => $seed ] : new \stdClass(),
         ];
 
-        $this->applyQuery($function, $query);
+        $this->applyFilter($function, $query);
 
         $this->functions[] = $function;
 
@@ -191,7 +191,7 @@ class FunctionScoreQuery implements BuilderInterface
             ),
         ];
 
-        $this->applyQuery($function, $query);
+        $this->applyFilter($function, $query);
 
         $this->functions[] = $function;
 
-- 
GitLab