コード例 #1
0
Hash*
DefDelWriter_Metadata_IMP(DefaultDeletionsWriter *self) {
    DefaultDeletionsWriterIVARS *const ivars = DefDelWriter_IVARS(self);
    DefDelWriter_Metadata_t super_meta
        = (DefDelWriter_Metadata_t)SUPER_METHOD_PTR(DEFAULTDELETIONSWRITER,
                                                    LUCY_DefDelWriter_Metadata);
    Hash    *const metadata = super_meta(self);
    Hash    *const files    = Hash_new(0);

    for (uint32_t i = 0, max = VA_Get_Size(ivars->seg_readers); i < max; i++) {
        SegReader *seg_reader = (SegReader*)VA_Fetch(ivars->seg_readers, i);
        if (ivars->updated[i]) {
            BitVector *deldocs   = (BitVector*)VA_Fetch(ivars->bit_vecs, i);
            Segment   *segment   = SegReader_Get_Segment(seg_reader);
            Hash      *mini_meta = Hash_new(2);
            Hash_Store_Utf8(mini_meta, "count", 5,
                            (Obj*)Str_newf("%u32", (uint32_t)BitVec_Count(deldocs)));
            Hash_Store_Utf8(mini_meta, "filename", 8,
                            (Obj*)S_del_filename(self, seg_reader));
            Hash_Store(files, (Obj*)Seg_Get_Name(segment), (Obj*)mini_meta);
        }
    }
    Hash_Store_Utf8(metadata, "files", 5, (Obj*)files);

    return metadata;
}
コード例 #2
0
ファイル: SortWriter.c プロジェクト: apache/lucy
Hash*
SortWriter_Metadata_IMP(SortWriter *self) {
    SortWriterIVARS *const ivars = SortWriter_IVARS(self);
    SortWriter_Metadata_t super_meta
        = (SortWriter_Metadata_t)SUPER_METHOD_PTR(SORTWRITER,
                                                  LUCY_SortWriter_Metadata);
    Hash *const metadata = super_meta(self);
    Hash_Store_Utf8(metadata, "counts", 6, INCREF(ivars->counts));
    Hash_Store_Utf8(metadata, "null_ords", 9, INCREF(ivars->null_ords));
    Hash_Store_Utf8(metadata, "ord_widths", 10, INCREF(ivars->ord_widths));
    return metadata;
}