Skip to content

Commit aee2d18

Browse files
revert debug change + dry
1 parent bb2af54 commit aee2d18

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

server/src/main/java/org/elasticsearch/action/search/ArraySearchPhaseResults.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Stream<Result> getSuccessfulResults() {
4343
@Override
4444
void consumeResult(Result result, Runnable next) {
4545
assert results.get(result.getShardIndex()) == null : "shardIndex: " + result.getShardIndex() + " is already set";
46-
results.setOnce(result.getShardIndex(), result);
46+
results.set(result.getShardIndex(), result);
4747
result.incRef();
4848
next.run();
4949
}

server/src/main/java/org/elasticsearch/common/lucene/Lucene.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ public static void writeTopDocsIncludingShardIndex(StreamOutput out, TopDocs top
429429
} else {
430430
out.writeByte((byte) 0);
431431
writeTotalHits(out, topDocs.totalHits);
432-
out.writeArray(Lucene::writeScoreDocWithShardIndex, topDocs.scoreDocs);
432+
out.writeArray((o, scoreDoc) -> {
433+
writeScoreDoc(o, scoreDoc);
434+
o.writeVInt(scoreDoc.shardIndex);
435+
}, topDocs.scoreDocs);
433436
}
434437
}
435438

@@ -587,15 +590,6 @@ public static void writeScoreDoc(StreamOutput out, ScoreDoc scoreDoc) throws IOE
587590
out.writeFloat(scoreDoc.score);
588591
}
589592

590-
public static void writeScoreDocWithShardIndex(StreamOutput out, ScoreDoc scoreDoc) throws IOException {
591-
if (scoreDoc.getClass().equals(ScoreDoc.class) == false) {
592-
throw new IllegalArgumentException("This method can only be used to serialize a ScoreDoc, not a " + scoreDoc.getClass());
593-
}
594-
out.writeVInt(scoreDoc.doc);
595-
out.writeFloat(scoreDoc.score);
596-
out.writeVInt(scoreDoc.shardIndex);
597-
}
598-
599593
// LUCENE 4 UPGRADE: We might want to maintain our own ordinal, instead of Lucene's ordinal
600594
public static SortField.Type readSortType(StreamInput in) throws IOException {
601595
return SortField.Type.values()[in.readVInt()];

0 commit comments

Comments
 (0)