Skip to content
Snippets Groups Projects
Unverified Commit 53501e27 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

fix function score test

parent 5df18c93
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ class FunctionScoreQueryTest extends AbstractElasticsearchTestCase
],
[
'title' => 'bar',
'price' => 30,
'price' => 10,
],
]
];
......@@ -61,12 +61,16 @@ class FunctionScoreQueryTest extends AbstractElasticsearchTestCase
{
$fquery = new FunctionScoreQuery(new MatchAllQuery());
$fquery->addScriptScoreFunction(
'if (doc[\'price\'].value > ctx._source.target)
{ return doc[\'price\'].value * (1 - ctx._source.discount); }
return doc[\'price\'].value;',
"
if (doc['price'].value < params.target)
{
return doc['price'].value * params.charge;
}
return doc['price'].value;
",
[
'target' => 20,
'discount' => 0.9,
'target' => 10,
'charge' => 0.9,
]
);
......
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