test was missing tie-break for the two suggestions

This commit is contained in:
mikemccand 2014-04-24 15:41:44 -04:00
parent c1e03bf860
commit 84af7d9f9a
1 changed files with 8 additions and 3 deletions

View File

@ -780,11 +780,16 @@ public class CompletionSuggestSearchTests extends ElasticsearchIntegrationTest {
createIndexAndMappingAndSettings(settingsBuilder.build(), completionMappingBuilder); createIndexAndMappingAndSettings(settingsBuilder.build(), completionMappingBuilder);
client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder() client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder()
.startObject().field(FIELD, "Feed trolls").endObject() .startObject().startObject(FIELD)
.startArray("input").value("Feed trolls").endArray()
.field("weight", 5).endObject().endObject()
).get(); ).get();
client().prepareIndex(INDEX, TYPE, "2").setSource(jsonBuilder() // Higher weight so it's ranked first:
.startObject().field(FIELD, "Feed the trolls").endObject() client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder()
.startObject().startObject(FIELD)
.startArray("input").value("Feed the trolls").endArray()
.field("weight", 10).endObject().endObject()
).get(); ).get();
refresh(); refresh();