class Corpus {
public:
Corpus(FILE *outfp, size_t block_size)
- : invindex(new PostingListBuilder *[NUM_TRIGRAMS]), outfp(outfp), block_size(block_size) {}
+ : invindex(new PostingListBuilder *[NUM_TRIGRAMS]), outfp(outfp), block_size(block_size) {
+ fill(invindex.get(), invindex.get() + NUM_TRIGRAMS, nullptr);
+ }
void add_file(string filename);
void flush_block();
hdr.version = -1; // Mark as broken.
hdr.hashtable_size = 0; // Not known yet.
hdr.extra_ht_slots = num_overflow_slots;
+ hdr.num_docids = 0;
hdr.hash_table_offset_bytes = -1; // We don't know these offsets yet.
hdr.filename_index_offset_bytes = -1;
fwrite(&hdr, sizeof(hdr), 1, outfp);