From 9ce66cb16711cdaf023dc1e2145f3260eeccbbb3 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Sat, 28 Jun 2014 09:12:25 +0200 Subject: [PATCH] [TEST] Testcase for #6639 --- .../search/sort/SimpleSortTests.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java b/src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java index 70788234b26..429e3ba27aa 100644 --- a/src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java +++ b/src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java @@ -20,6 +20,7 @@ package org.elasticsearch.search.sort; +import com.carrotsearch.randomizedtesting.annotations.Repeat; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.UnicodeUtil; @@ -60,6 +61,25 @@ import static org.hamcrest.Matchers.*; */ public class SimpleSortTests extends ElasticsearchIntegrationTest { + public void testIssue6639() throws ExecutionException, InterruptedException { + assertAcked(prepareCreate("$index") + .addMapping("$type","{\"$type\": {\"_boost\": {\"name\": \"boost\", \"null_value\": 1.0}, \"properties\": {\"grantee\": {\"index\": \"not_analyzed\", \"term_vector\": \"with_positions_offsets\", \"type\": \"string\", \"analyzer\": \"snowball\", \"boost\": 1.0, \"store\": \"yes\"}}}}")); + indexRandom(true, + client().prepareIndex("$index", "$type", "data.activity.5").setSource("{\"django_ct\": \"data.activity\", \"grantee\": \"Grantee 1\"}"), + client().prepareIndex("$index", "$type", "data.activity.6").setSource("{\"django_ct\": \"data.activity\", \"grantee\": \"Grantee 2\"}")); + ensureYellow(); + SearchResponse searchResponse = client().prepareSearch() + .setQuery(matchAllQuery()) + .addSort("grantee", SortOrder.ASC) + .execute().actionGet(); + assertOrderedSearchHits(searchResponse, "data.activity.5", "data.activity.6"); + searchResponse = client().prepareSearch() + .setQuery(matchAllQuery()) + .addSort("grantee", SortOrder.DESC) + .execute().actionGet(); + assertOrderedSearchHits(searchResponse, "data.activity.6", "data.activity.5"); + } + @Test public void testTrackScores() throws Exception { createIndex("test");