RawPostingWriter* RawPostWriter_init(RawPostingWriter *self, Schema *schema, Snapshot *snapshot, Segment *segment, PolyReader *polyreader, OutStream *outstream) { const int32_t invalid_field_num = 0; PostWriter_init((PostingWriter*)self, schema, snapshot, segment, polyreader, invalid_field_num); RawPostingWriterIVARS *const ivars = RawPostWriter_IVARS(self); ivars->outstream = (OutStream*)INCREF(outstream); ivars->last_doc_id = 0; return self; }
MatchPostingWriter* MatchPostWriter_init(MatchPostingWriter *self, Schema *schema, Snapshot *snapshot, Segment *segment, PolyReader *polyreader, int32_t field_num) { Folder *folder = PolyReader_Get_Folder(polyreader); CharBuf *filename = CB_newf("%o/postings-%i32.dat", Seg_Get_Name(segment), field_num); PostWriter_init((PostingWriter*)self, schema, snapshot, segment, polyreader, field_num); self->outstream = Folder_Open_Out(folder, filename); if (!self->outstream) { RETHROW(INCREF(Err_get_error())); } DECREF(filename); return self; }