]> git.sesse.net Git - plocate/blobdiff - plocate.cpp
Fix searching for very short (1 or 2 bytes) queries.
[plocate] / plocate.cpp
index fa70f76c6531f97f3d574217b95b71e510c8126f..fc8c4becdbde9f77f8490eef8a8e953426206b9b 100644 (file)
@@ -188,12 +188,7 @@ void Corpus::get_compressed_filename_block(uint32_t docid, function<void(string)
 
 size_t Corpus::get_num_filename_blocks() const
 {
-       // The beginning of the filename blocks is the end of the filename index blocks.
-       uint64_t end;
-       complete_pread(fd, &end, sizeof(end), hdr.filename_index_offset_bytes);
-
-       // Subtract the sentinel block.
-       return (end - hdr.filename_index_offset_bytes) / sizeof(uint64_t) - 1;
+       return hdr.num_docids;
 }
 
 size_t scan_file_block(const vector<string> &needles, string_view compressed,