Skip to content

Commit

Permalink
Add logging for case when we found too many docs per hash
Browse files Browse the repository at this point in the history
  • Loading branch information
lalinsky committed Dec 12, 2024
1 parent 05e2b56 commit 266324d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/FileSegment.zig
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pub fn search(self: Self, sorted_hashes: []const u32, results: *SearchResults, d
}
prev_block_range_start = block_no;

var num_docs: usize = 0;
while (block_no < self.index.items.len and self.index.items[block_no] <= hash) : (block_no += 1) {
if (block_no != prev_block_no) {
prev_block_no = block_no;
Expand All @@ -104,6 +105,11 @@ pub fn search(self: Self, sorted_hashes: []const u32, results: *SearchResults, d
for (matches[0]..matches[1]) |j| {
try results.incr(block_items.items[j].id, self.info.version);
}
num_docs += matches[1] - matches[0];
}

if (num_docs > 1000) {
log.warn("found {} docs for hash {}", .{ num_docs, hash });
}

if (i % 10 == 0) {
Expand Down

0 comments on commit 266324d

Please sign in to comment.