[TEST] Fix GroovyScriptTests failures.

This commit is contained in:
Adrien Grand 2014-12-31 10:02:45 +01:00
parent 6304f68715
commit 56974bf867
1 changed files with 3 additions and 1 deletions

View File

@ -140,8 +140,10 @@ public class GroovyScriptTests extends ElasticsearchIntegrationTest {
assertSearchHits(resp, "3", "1");
// _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"))
.add(scriptFunction("_score > 0 ? _score : 0", "groovy"))
.add(scriptFunction("_score > 0.0 ? _score : 0", "groovy"))
.boostMode(CombineFunction.REPLACE)).get();
assertNoFailures(resp);
assertSearchHits(resp, "3", "1");