Tests: Fixed CompletionSuggester test which relied on a bug

This commit is contained in:
Clinton Gormley 2014-06-10 21:34:03 +02:00
parent 0859f2e588
commit c25de57d5d
1 changed files with 5 additions and 3 deletions

View File

@ -18,6 +18,7 @@
*/
package org.elasticsearch.search.suggest;
import com.carrotsearch.hppc.ObjectLongOpenHashMap;
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
import com.google.common.collect.Lists;
import org.elasticsearch.ExceptionsHelper;
@ -662,7 +663,7 @@ public class CompletionSuggestSearchTests extends ElasticsearchIntegrationTest {
PutMappingResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject()
.startObject(TYPE).startObject("properties")
.startObject(FIELD)
.startObject(FIELD.toString())
.field("type", "completion").field("analyzer", "simple")
.endObject()
.startObject(otherField)
@ -691,7 +692,8 @@ public class CompletionSuggestSearchTests extends ElasticsearchIntegrationTest {
// regexes
IndicesStatsResponse regexFieldStats = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true).setCompletionFields("*").get();
long regexSizeInBytes = regexFieldStats.getIndex(INDEX).getPrimaries().completion.getFields().get("*");
ObjectLongOpenHashMap<String> fields = regexFieldStats.getIndex(INDEX).getPrimaries().completion.getFields();
long regexSizeInBytes = fields.get(FIELD) + fields.get(otherField);
assertThat(regexSizeInBytes, is(totalSizeInBytes));
}