Skip to content

Commit

Permalink
HSEARCH-2662 Lucene: Fix behavior when querying dynamically sharded i…
Browse files Browse the repository at this point in the history
…ndexes with no shard

We used to throw an NPE at some point. We may as well not try to search
at all, since we know there won't be any result from the start.
  • Loading branch information
yrodiere authored and Sanne committed Apr 13, 2017
1 parent 4e8b0ca commit 2e664de
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -458,6 +458,13 @@ private LazyQueryState buildSearcher(ExtendedSearchIntegrator extendedIntegrator
}
this.idFieldNames = idFieldNames;

if ( targetedIndexes.isEmpty() ) {
/*
* May happen when searching on indexes with dynamic sharding that haven't any shard yet.
*/
return null;
}

//compute optimization needClassFilterClause
//if at least one DP contains one class that is not part of the targeted classesAndSubclasses we can't optimize
if ( classesAndSubclasses != null ) {
Expand Down

0 comments on commit 2e664de

Please sign in to comment.