[TEST] Fix GroovyScriptTests failures.
This commit is contained in:
parent
6304f68715
commit
56974bf867
|
@ -140,8 +140,10 @@ public class GroovyScriptTests extends ElasticsearchIntegrationTest {
|
||||||
assertSearchHits(resp, "3", "1");
|
assertSearchHits(resp, "3", "1");
|
||||||
|
|
||||||
// _score is comparable
|
// _score is comparable
|
||||||
|
// NOTE: it is important to use 0.0 instead of 0 instead Groovy will do an integer comparison
|
||||||
|
// and if the score if between 0 and 1 it will be considered equal to 0 due to the cast
|
||||||
resp = client().prepareSearch("test").setQuery(functionScoreQuery(matchQuery("foo", "dog"))
|
resp = client().prepareSearch("test").setQuery(functionScoreQuery(matchQuery("foo", "dog"))
|
||||||
.add(scriptFunction("_score > 0 ? _score : 0", "groovy"))
|
.add(scriptFunction("_score > 0.0 ? _score : 0", "groovy"))
|
||||||
.boostMode(CombineFunction.REPLACE)).get();
|
.boostMode(CombineFunction.REPLACE)).get();
|
||||||
assertNoFailures(resp);
|
assertNoFailures(resp);
|
||||||
assertSearchHits(resp, "3", "1");
|
assertSearchHits(resp, "3", "1");
|
||||||
|
|
Loading…
Reference in New Issue