gf2121 commented on code in PR #14679: URL: https://github.com/apache/lucene/pull/14679#discussion_r2099767800
########## lucene/core/src/java/org/apache/lucene/search/TermScorer.java: ########## @@ -120,4 +126,54 @@ public void setMinCompetitiveScore(float minScore) { impactsDisi.setMinCompetitiveScore(minScore); } } + + @Override + public void nextDocsAndScores(int upTo, Bits liveDocs, DocAndScoreBuffer buffer) + throws IOException { + if (docAndFreqBuffer == null) { + docAndFreqBuffer = new DocAndFreqBuffer(); + } + + for (; ; ) { + postingsEnum.nextPostings(upTo, docAndFreqBuffer); + if (liveDocs != null && docAndFreqBuffer.size != 0) { + // An empty return value indicates that there are no more docs before upTo. We may be + // unlucky, and there are docs left, but all docs from the current batch happen to be marked + // as deleted. So we need to iterate until we find a batch that has at least one non-deleted + // doc. + docAndFreqBuffer.apply(liveDocs); + if (docAndFreqBuffer.size == 0) { + continue; + } + } + break; + } + + int size = docAndFreqBuffer.size; + if (normValues.length < size) { + normValues = new long[ArrayUtil.oversize(size, Long.BYTES)]; + if (norms == null) { + Arrays.fill(normValues, 1L); + } + } + normValues = ArrayUtil.growNoCopy(normValues, size); Review Comment: This line can be removed? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org