Obj* PhraseQuery_Dump_IMP(PhraseQuery *self) { PhraseQueryIVARS *ivars = PhraseQuery_IVARS(self); PhraseQuery_Dump_t super_dump = SUPER_METHOD_PTR(PHRASEQUERY, LUCY_PhraseQuery_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field)); Hash_Store_Utf8(dump, "terms", 5, Freezer_dump((Obj*)ivars->terms)); return (Obj*)dump; }
Obj* TermQuery_Dump_IMP(TermQuery *self) { TermQueryIVARS *ivars = TermQuery_IVARS(self); TermQuery_Dump_t super_dump = SUPER_METHOD_PTR(TERMQUERY, LUCY_TermQuery_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field)); Hash_Store_Utf8(dump, "term", 4, Freezer_dump(ivars->term)); return (Obj*)dump; }
Obj* ProximityQuery_Dump_IMP(ProximityQuery *self) { ProximityQueryIVARS *ivars = ProximityQuery_IVARS(self); ProximityQuery_Dump_t super_dump = SUPER_METHOD_PTR(PROXIMITYQUERY, LUCY_ProximityQuery_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field)); Hash_Store_Utf8(dump, "terms", 5, Freezer_dump((Obj*)ivars->terms)); Hash_Store_Utf8(dump, "within", 6, (Obj*)Str_newf("%i64", (int64_t)ivars->within)); return (Obj*)dump; }
Obj* LeafQuery_Dump_IMP(LeafQuery *self) { LeafQueryIVARS *ivars = LeafQuery_IVARS(self); LeafQuery_Dump_t super_dump = SUPER_METHOD_PTR(LEAFQUERY, LUCY_LeafQuery_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); if (ivars->field) { Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field)); } Hash_Store_Utf8(dump, "text", 4, Freezer_dump((Obj*)ivars->text)); return (Obj*)dump; }
Obj* PolyQuery_Dump_IMP(PolyQuery *self) { PolyQueryIVARS *ivars = PolyQuery_IVARS(self); PolyQuery_Dump_t super_dump = SUPER_METHOD_PTR(POLYQUERY, LUCY_PolyQuery_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); Hash_Store_Utf8(dump, "children", 8, Freezer_dump((Obj*)ivars->children)); return (Obj*)dump; }
static Obj* S_dump_array(Vector *array) { Vector *dump = Vec_new(Vec_Get_Size(array)); for (size_t i = 0, max = Vec_Get_Size(array); i < max; i++) { Obj *elem = Vec_Fetch(array, i); if (elem) { Vec_Store(dump, i, Freezer_dump(elem)); } } return (Obj*)dump; }
Obj* PolyAnalyzer_Dump_IMP(PolyAnalyzer *self) { PolyAnalyzerIVARS *const ivars = PolyAnalyzer_IVARS(self); PolyAnalyzer_Dump_t super_dump = SUPER_METHOD_PTR(POLYANALYZER, LUCY_PolyAnalyzer_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); if (ivars->analyzers) { Hash_Store_Utf8(dump, "analyzers", 9, Freezer_dump((Obj*)ivars->analyzers)); } return (Obj*)dump; }
Obj* RangeQuery_Dump_IMP(RangeQuery *self) { RangeQueryIVARS *ivars = RangeQuery_IVARS(self); RangeQuery_Dump_t super_dump = SUPER_METHOD_PTR(RANGEQUERY, LUCY_RangeQuery_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field)); if (ivars->lower_term) { Hash_Store_Utf8(dump, "lower_term", 10, Freezer_dump((Obj*)ivars->lower_term)); } if (ivars->upper_term) { Hash_Store_Utf8(dump, "upper_term", 10, Freezer_dump((Obj*)ivars->upper_term)); } Hash_Store_Utf8(dump, "include_lower", 13, (Obj*)Bool_singleton(ivars->include_lower)); Hash_Store_Utf8(dump, "include_upper", 13, (Obj*)Bool_singleton(ivars->include_upper)); return (Obj*)dump; }
Obj* SnowStop_Dump_IMP(SnowballStopFilter *self) { SnowballStopFilterIVARS *ivars = SnowStop_IVARS(self); SnowStop_Dump_t super_dump = SUPER_METHOD_PTR(SNOWBALLSTOPFILTER, LUCY_SnowStop_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); if (ivars->stoplist) { Hash_Store_Utf8(dump, "stoplist", 8, Freezer_dump((Obj*)ivars->stoplist)); } return (Obj*)dump; }
Obj* S_dump_hash(Hash *hash) { Hash *dump = Hash_new(Hash_Get_Size(hash)); HashIterator *iter = HashIter_new(hash); while (HashIter_Next(iter)) { String *key = HashIter_Get_Key(iter); Obj *value = HashIter_Get_Value(iter); Hash_Store(dump, key, Freezer_dump(value)); } DECREF(iter); return (Obj*)dump; }
Hash* Schema_Dump_IMP(Schema *self) { SchemaIVARS *const ivars = Schema_IVARS(self); Hash *dump = Hash_new(0); Hash *type_dumps = Hash_new(Hash_Get_Size(ivars->types)); // Record class name, store dumps of unique Analyzers. Hash_Store_Utf8(dump, "_class", 6, (Obj*)Str_Clone(Schema_get_class_name(self))); Hash_Store_Utf8(dump, "analyzers", 9, Freezer_dump((Obj*)ivars->uniq_analyzers)); // Dump FieldTypes. Hash_Store_Utf8(dump, "fields", 6, (Obj*)type_dumps); HashIterator *iter = HashIter_new(ivars->types); while (HashIter_Next(iter)) { String *field = HashIter_Get_Key(iter); FieldType *type = (FieldType*)HashIter_Get_Value(iter); Class *type_class = FType_get_class(type); // Dump known types to simplified format. if (type_class == FULLTEXTTYPE) { FullTextType *fttype = (FullTextType*)type; Hash *type_dump = FullTextType_Dump_For_Schema(fttype); Analyzer *analyzer = FullTextType_Get_Analyzer(fttype); uint32_t tick = S_find_in_array(ivars->uniq_analyzers, (Obj*)analyzer); // Store the tick which references a unique analyzer. Hash_Store_Utf8(type_dump, "analyzer", 8, (Obj*)Str_newf("%u32", tick)); Hash_Store(type_dumps, field, (Obj*)type_dump); } else if (type_class == STRINGTYPE || type_class == BLOBTYPE) { Hash *type_dump = FType_Dump_For_Schema(type); Hash_Store(type_dumps, field, (Obj*)type_dump); } // Unknown FieldType type, so punt. else { Hash_Store(type_dumps, field, FType_Dump(type)); } } DECREF(iter); return dump; }