From 70442dc9bb6a378f2457b4a38c7ebcbed5a68a6e Mon Sep 17 00:00:00 2001 From: Johannes Baiter Date: Wed, 29 May 2024 10:48:14 +0200 Subject: [PATCH] Fix bad total snippets counts. 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. --- .../dbmdz/solrocr/lucene/OcrFieldHighlighter.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/github/dbmdz/solrocr/lucene/OcrFieldHighlighter.java b/src/main/java/com/github/dbmdz/solrocr/lucene/OcrFieldHighlighter.java index 5d3d9128..100ac456 100644 --- a/src/main/java/com/github/dbmdz/solrocr/lucene/OcrFieldHighlighter.java +++ b/src/main/java/com/github/dbmdz/solrocr/lucene/OcrFieldHighlighter.java @@ -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.