Skip to content

Commit

Permalink
Fix ids query test when none or ALL type is used
Browse files Browse the repository at this point in the history
See #24460
  • Loading branch information
rjernst committed May 9, 2017
1 parent d2416a3 commit 53f6d94
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.lucene.search.Query;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.index.mapper.UidFieldMapper;
import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.test.AbstractQueryTestCase;

Expand Down Expand Up @@ -73,7 +74,8 @@ protected IdsQueryBuilder doCreateTestQueryBuilder() {

@Override
protected void doAssertLuceneQuery(IdsQueryBuilder queryBuilder, Query query, SearchContext context) throws IOException {
if (queryBuilder.ids().size() == 0) {
if (queryBuilder.ids().size() == 0 || queryBuilder.types().length == 0 ||
(queryBuilder.types().length == 1 && queryBuilder.types()[0].equals(MetaData.ALL))) {
assertThat(query, instanceOf(MatchNoDocsQuery.class));
} else {
assertThat(query, instanceOf(TermInSetQuery.class));
Expand Down

1 comment on commit 53f6d94

@jpountz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Please sign in to comment.