Skip to content

Commit

Permalink
Fix bad total snippets counts.
Browse files Browse the repository at this point in the history
Turns out we were mixing up the counts between multiple documents by
keying according to the leaf-reader-relativ docId instead of the
index-absolute docId. This led to differing total counts between
different runs of one and the same query, which is how this was
discovered. Total counts should be accurate now.
  • Loading branch information
jbaiter committed Jun 10, 2024
1 parent 6eb02e9 commit 70442dc
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,11 @@ public OcrSnippet[] highlightFieldForDoc(
}

Passage[] passages;
try (OffsetsEnum offsetsEnums = fieldOffsetStrategy.getOffsetsEnum(reader, readerDocId, null)) {
try (OffsetsEnum offsetsEnums =
fieldOffsetStrategy.getOffsetsEnum(reader, readerDocId, null)) {
passages =
highlightOffsetsEnums(
offsetsEnums,
indexDocId,
breakLocator,
formatter,
pageId,
snippetLimit,
scorePassages);
offsetsEnums, indexDocId, breakLocator, formatter, pageId, snippetLimit, scorePassages);
}

// Format the resulting Passages.
Expand Down

0 comments on commit 70442dc

Please sign in to comment.