From cade6465e82765fbe1d31d08e615765ec8584815 Mon Sep 17 00:00:00 2001 From: mikemccand Date: Thu, 24 Apr 2014 15:41:44 -0400 Subject: [PATCH] test was missing tie-break for the two suggestions --- .../search/suggest/CompletionSuggestSearchTests.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java b/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java index 48d8daa047eab..00735d5b025d6 100644 --- a/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java +++ b/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java @@ -780,11 +780,16 @@ public void testThatSuggestStopFilterWorks() throws Exception { createIndexAndMappingAndSettings(settingsBuilder.build(), completionMappingBuilder); 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(); - client().prepareIndex(INDEX, TYPE, "2").setSource(jsonBuilder() - .startObject().field(FIELD, "Feed the trolls").endObject() + // Higher weight so it's ranked first: + client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder() + .startObject().startObject(FIELD) + .startArray("input").value("Feed the trolls").endArray() + .field("weight", 10).endObject().endObject() ).get(); refresh();