Add comment why we check for null fetch results during merge

This commit is contained in:
Simon Willnauer 2017-04-07 21:00:04 +02:00
parent 457a76c1c6
commit 0c465b1931
1 changed files with 8 additions and 0 deletions

View File

@ -304,6 +304,10 @@ public final class SearchPhaseController extends AbstractComponent {
ScoreDoc shardDoc = sortedDocs[scoreDocIndex];
SearchPhaseResult searchResultProvider = resultsLookup.apply(shardDoc.shardIndex);
if (searchResultProvider == null) {
// this can happen if we are hitting a shard failure during the fetch phase
// in this case we referenced the shard result via teh ScoreDoc but never got a
// result from fetch.
// TODO it would be nice to assert this in the future
continue;
}
FetchSearchResult fetchResult = searchResultProvider.fetchResult();
@ -358,6 +362,10 @@ public final class SearchPhaseController extends AbstractComponent {
ScoreDoc shardDoc = sortedDocs[i];
SearchPhaseResult fetchResultProvider = resultsLookup.apply(shardDoc.shardIndex);
if (fetchResultProvider == null) {
// this can happen if we are hitting a shard failure during the fetch phase
// in this case we referenced the shard result via teh ScoreDoc but never got a
// result from fetch.
// TODO it would be nice to assert this in the future
continue;
}
FetchSearchResult fetchResult = fetchResultProvider.fetchResult();