(index-reader) Correctly handle negative offset values

When wordOffset(...) returns a negative value, it means the word isn't present in the index, and we should abort.
This commit is contained in:
Viktor Lofgren 2024-07-10 23:17:30 +02:00
parent 12590d3449
commit 9881cac2da

View File

@ -81,6 +81,9 @@ public class PrioReverseIndexReader {
long offset = wordOffset(termId);
if (offset < 0) // No documents
return 0;
ByteBuffer buffer = ByteBuffer.allocate(4);
try {
documentsChannel.read(buffer, offset);