Core: apply 'from' if there is one shard result.

This commit is contained in:
Martijn van Groningen 2014-05-31 13:35:11 +02:00
parent b8366a3213
commit 01ca8491cf
1 changed files with 5 additions and 1 deletions

View File

@ -177,9 +177,13 @@ public class SearchPhaseController extends AbstractComponent {
return EMPTY_DOCS;
}
int resultDocsSize = scoreDocs.length < result.size() ? scoreDocs.length : result.size();
int offset = result.from();
if (scrollSort) {
offset = 0;
}
ScoreDoc[] docs = new ScoreDoc[resultDocsSize];
for (int i = 0; i < resultDocsSize; i++) {
ScoreDoc scoreDoc = scoreDocs[i];
ScoreDoc scoreDoc = scoreDocs[offset + i];
scoreDoc.shardIndex = shardIndex;
docs[i] = scoreDoc;
}