[TEST] fix PhraseInIndex test bug for shard failure
This commit is contained in:
parent
76343899ea
commit
0173298f29
|
@ -1168,6 +1168,8 @@ public class SuggestSearchTests extends ElasticsearchIntegrationTest {
|
||||||
searchSuggest = searchSuggest("Elections of Representatives Parliament", filteredQuerySuggest);
|
searchSuggest = searchSuggest("Elections of Representatives Parliament", filteredQuerySuggest);
|
||||||
assertSuggestionSize(searchSuggest, 0, 0, "title");
|
assertSuggestionSize(searchSuggest, 0, 0, "title");
|
||||||
|
|
||||||
|
NumShards numShards = getNumShards("test");
|
||||||
|
|
||||||
// filtered suggest with bad query
|
// filtered suggest with bad query
|
||||||
String incorrectFilterString = XContentFactory.jsonBuilder()
|
String incorrectFilterString = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
|
@ -1178,7 +1180,7 @@ public class SuggestSearchTests extends ElasticsearchIntegrationTest {
|
||||||
.string();
|
.string();
|
||||||
PhraseSuggestionBuilder incorrectFilteredSuggest = suggest.collateQuery(incorrectFilterString);
|
PhraseSuggestionBuilder incorrectFilteredSuggest = suggest.collateQuery(incorrectFilterString);
|
||||||
try {
|
try {
|
||||||
searchSuggest("united states house of representatives elections in washington 2006", incorrectFilteredSuggest);
|
searchSuggest("united states house of representatives elections in washington 2006", numShards.numPrimaries, incorrectFilteredSuggest);
|
||||||
fail("Post query error has been swallowed");
|
fail("Post query error has been swallowed");
|
||||||
} catch(ElasticsearchException e) {
|
} catch(ElasticsearchException e) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -1210,7 +1212,7 @@ public class SuggestSearchTests extends ElasticsearchIntegrationTest {
|
||||||
|
|
||||||
PhraseSuggestionBuilder in = suggest.collateQuery(null).collateFilter(filterStr);
|
PhraseSuggestionBuilder in = suggest.collateQuery(null).collateFilter(filterStr);
|
||||||
try {
|
try {
|
||||||
searchSuggest("united states house of representatives elections in washington 2006", in);
|
searchSuggest("united states house of representatives elections in washington 2006", numShards.numPrimaries, in);
|
||||||
fail("Post filter error has been swallowed");
|
fail("Post filter error has been swallowed");
|
||||||
} catch(ElasticsearchException e) {
|
} catch(ElasticsearchException e) {
|
||||||
//expected
|
//expected
|
||||||
|
@ -1228,7 +1230,7 @@ public class SuggestSearchTests extends ElasticsearchIntegrationTest {
|
||||||
|
|
||||||
PhraseSuggestionBuilder phraseSuggestWithNoParams = suggest.collateFilter(null).collateQuery(collateWithParams);
|
PhraseSuggestionBuilder phraseSuggestWithNoParams = suggest.collateFilter(null).collateQuery(collateWithParams);
|
||||||
try {
|
try {
|
||||||
searchSuggest("united states house of representatives elections in washington 2006", phraseSuggestWithNoParams);
|
searchSuggest("united states house of representatives elections in washington 2006", numShards.numPrimaries, phraseSuggestWithNoParams);
|
||||||
fail("Malformed query (lack of additional params) should fail");
|
fail("Malformed query (lack of additional params) should fail");
|
||||||
} catch (ElasticsearchException e) {
|
} catch (ElasticsearchException e) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -1246,7 +1248,7 @@ public class SuggestSearchTests extends ElasticsearchIntegrationTest {
|
||||||
//collate request defining both query/filter should fail
|
//collate request defining both query/filter should fail
|
||||||
PhraseSuggestionBuilder phraseSuggestWithFilterAndQuery = suggest.collateFilter(filterStringAsFilter).collateQuery(filterString);
|
PhraseSuggestionBuilder phraseSuggestWithFilterAndQuery = suggest.collateFilter(filterStringAsFilter).collateQuery(filterString);
|
||||||
try {
|
try {
|
||||||
searchSuggest("united states house of representatives elections in washington 2006", phraseSuggestWithFilterAndQuery);
|
searchSuggest("united states house of representatives elections in washington 2006", numShards.numPrimaries, phraseSuggestWithFilterAndQuery);
|
||||||
fail("expected parse failure, as both filter and query are set in collate");
|
fail("expected parse failure, as both filter and query are set in collate");
|
||||||
} catch (ElasticsearchException e) {
|
} catch (ElasticsearchException e) {
|
||||||
// expected
|
// expected
|
||||||
|
|
Loading…
Reference in New Issue