mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
(index-reverse) Entry Sources reset() their LongQueryBuffer
Previously this was the responsibility of the caller, which lead to the possibility of passing in improperly prepared buffers and receiving bad outcome
This commit is contained in:
parent
12a2ab93db
commit
0d29e2a39d
@ -36,6 +36,7 @@ public class FullIndexEntrySource implements EntrySource {
|
||||
|
||||
@Override
|
||||
public void read(LongQueryBuffer buffer) {
|
||||
buffer.reset();
|
||||
buffer.end = min(buffer.end, endOffset - pos);
|
||||
reader.readData(buffer.data, buffer.end, pos);
|
||||
pos += buffer.end;
|
||||
|
@ -42,6 +42,7 @@ public class PrioIndexEntrySource implements EntrySource {
|
||||
@SneakyThrows
|
||||
@SuppressWarnings("preview")
|
||||
public void read(LongQueryBuffer buffer) {
|
||||
buffer.reset();
|
||||
buffer.end = min(buffer.end, endOffsetL - posL);
|
||||
|
||||
var byteBuffer = buffer.data.getMemorySegment().asByteBuffer();
|
||||
|
@ -73,8 +73,6 @@ public class IndexQuery {
|
||||
|
||||
private boolean fillBuffer(LongQueryBuffer dest) {
|
||||
for (;;) {
|
||||
dest.reset();
|
||||
|
||||
EntrySource source = sources.get(si);
|
||||
source.read(dest);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user