Skip to content
Snippets Groups Projects
Commit 7130a661 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas Committed by GitHub
Browse files

Merge pull request #122 from saimaz/function_score_fix

Fix bug for functionscore functions filters implementation
parents 69282867 fd71e255
No related branches found
No related tags found
No related merge requests found
...@@ -52,15 +52,15 @@ class FunctionScoreQuery implements BuilderInterface ...@@ -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 array $function
* @param BuilderInterface $query * @param BuilderInterface $query
*/ */
private function applyQuery(array &$function, BuilderInterface $query = null) private function applyFilter(array &$function, BuilderInterface $query = null)
{ {
if ($query) { if ($query) {
$function['query'] = $query->toArray(); $function['filter'] = $query->toArray();
} }
} }
...@@ -84,7 +84,7 @@ class FunctionScoreQuery implements BuilderInterface ...@@ -84,7 +84,7 @@ class FunctionScoreQuery implements BuilderInterface
], ],
]; ];
$this->applyQuery($function, $query); $this->applyFilter($function, $query);
$this->functions[] = $function; $this->functions[] = $function;
...@@ -116,7 +116,7 @@ class FunctionScoreQuery implements BuilderInterface ...@@ -116,7 +116,7 @@ class FunctionScoreQuery implements BuilderInterface
), ),
]; ];
$this->applyQuery($function, $query); $this->applyFilter($function, $query);
$this->functions[] = $function; $this->functions[] = $function;
...@@ -137,7 +137,7 @@ class FunctionScoreQuery implements BuilderInterface ...@@ -137,7 +137,7 @@ class FunctionScoreQuery implements BuilderInterface
'weight' => $weight, 'weight' => $weight,
]; ];
$this->applyQuery($function, $query); $this->applyFilter($function, $query);
$this->functions[] = $function; $this->functions[] = $function;
...@@ -158,7 +158,7 @@ class FunctionScoreQuery implements BuilderInterface ...@@ -158,7 +158,7 @@ class FunctionScoreQuery implements BuilderInterface
'random_score' => $seed ? [ 'seed' => $seed ] : new \stdClass(), 'random_score' => $seed ? [ 'seed' => $seed ] : new \stdClass(),
]; ];
$this->applyQuery($function, $query); $this->applyFilter($function, $query);
$this->functions[] = $function; $this->functions[] = $function;
...@@ -191,7 +191,7 @@ class FunctionScoreQuery implements BuilderInterface ...@@ -191,7 +191,7 @@ class FunctionScoreQuery implements BuilderInterface
), ),
]; ];
$this->applyQuery($function, $query); $this->applyFilter($function, $query);
$this->functions[] = $function; $this->functions[] = $function;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment