Hash* Normalizer_dump(Normalizer *self) { Normalizer_Dump_t super_dump = SUPER_METHOD_PTR(NORMALIZER, Lucy_Normalizer_Dump); Hash *dump = super_dump(self); int options = self->options; CharBuf *form = options & UTF8PROC_COMPOSE ? options & UTF8PROC_COMPAT ? CB_new_from_trusted_utf8("NFKC", 4) : CB_new_from_trusted_utf8("NFC", 3) : options & UTF8PROC_COMPAT ? CB_new_from_trusted_utf8("NFKD", 4) : CB_new_from_trusted_utf8("NFD", 3); Hash_Store_Str(dump, "normalization_form", 18, (Obj*)form); BoolNum *case_fold = Bool_singleton(options & UTF8PROC_CASEFOLD); Hash_Store_Str(dump, "case_fold", 9, (Obj*)case_fold); BoolNum *strip_accents = Bool_singleton(options & UTF8PROC_STRIPMARK); Hash_Store_Str(dump, "strip_accents", 13, (Obj*)strip_accents); return dump; }
void SortColl_Set_Reader_IMP(SortCollector *self, SegReader *reader) { SortCollectorIVARS *const ivars = SortColl_IVARS(self); SortReader *sort_reader = (SortReader*)SegReader_Fetch(reader, Class_Get_Name(SORTREADER)); // Reset threshold variables and trigger auto-action behavior. MatchDocIVARS *const bumped_ivars = MatchDoc_IVARS(ivars->bumped); bumped_ivars->doc_id = INT32_MAX; ivars->bubble_doc = INT32_MAX; bumped_ivars->score = ivars->need_score ? CHY_F32_NEGINF : CHY_F32_NAN; ivars->bubble_score = ivars->need_score ? CHY_F32_NEGINF : CHY_F32_NAN; ivars->actions = ivars->auto_actions; // Obtain sort caches. Derive actions array for this segment. if (ivars->need_values && sort_reader) { for (uint32_t i = 0, max = ivars->num_rules; i < max; i++) { SortRule *rule = (SortRule*)Vec_Fetch(ivars->rules, i); String *field = SortRule_Get_Field(rule); SortCache *cache = field ? SortReader_Fetch_Sort_Cache(sort_reader, field) : NULL; ivars->sort_caches[i] = cache; ivars->derived_actions[i] = S_derive_action(rule, cache); if (cache) { ivars->ord_arrays[i] = SortCache_Get_Ords(cache); } else { ivars->ord_arrays[i] = NULL; } } } ivars->seg_doc_max = reader ? SegReader_Doc_Max(reader) : 0; SortColl_Set_Reader_t super_set_reader = (SortColl_Set_Reader_t)SUPER_METHOD_PTR(SORTCOLLECTOR, LUCY_SortColl_Set_Reader); super_set_reader(self, reader); }
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; }
CaseFolder* CaseFolder_Load_IMP(CaseFolder *self, Obj *dump) { CaseFolder_Load_t super_load = SUPER_METHOD_PTR(CASEFOLDER, LUCY_CaseFolder_Load); CaseFolder *loaded = super_load(self, dump); return CaseFolder_init(loaded); }
Obj* RangeQuery_Load_IMP(RangeQuery *self, Obj *dump) { Hash *source = (Hash*)CERTIFY(dump, HASH); RangeQuery_Load_t super_load = SUPER_METHOD_PTR(RANGEQUERY, LUCY_RangeQuery_Load); RangeQuery *loaded = (RangeQuery*)super_load(self, dump); RangeQueryIVARS *loaded_ivars = RangeQuery_IVARS(loaded); Obj *field = CERTIFY(Hash_Fetch_Utf8(source, "field", 5), OBJ); loaded_ivars->field = (String*)CERTIFY(Freezer_load(field), STRING); Obj *lower_term = Hash_Fetch_Utf8(source, "lower_term", 10); if (lower_term) { loaded_ivars->lower_term = (Obj*)CERTIFY(Freezer_load(lower_term), OBJ); } Obj *upper_term = Hash_Fetch_Utf8(source, "upper_term", 10); if (upper_term) { loaded_ivars->upper_term = (Obj*)CERTIFY(Freezer_load(upper_term), OBJ); } Obj *include_lower = CERTIFY(Hash_Fetch_Utf8(source, "include_lower", 13), OBJ); loaded_ivars->include_lower = Json_obj_to_bool(include_lower); Obj *include_upper = CERTIFY(Hash_Fetch_Utf8(source, "include_upper", 13), OBJ); loaded_ivars->include_upper = Json_obj_to_bool(include_upper); return (Obj*)loaded; }
bool ORQuery_Equals_IMP(ORQuery *self, Obj *other) { if ((ORQuery*)other == self) { return true; } if (!Obj_is_a(other, ORQUERY)) { return false; } ORQuery_Equals_t super_equals = (ORQuery_Equals_t)SUPER_METHOD_PTR(ORQUERY, LUCY_ORQuery_Equals); return super_equals(self, other); }
void HitDoc_Serialize_IMP(HitDoc *self, OutStream *outstream) { HitDocIVARS *const ivars = HitDoc_IVARS(self); HitDoc_Serialize_t super_serialize = SUPER_METHOD_PTR(HITDOC, LUCY_HitDoc_Serialize); super_serialize(self, outstream); OutStream_Write_F32(outstream, ivars->score); }
void BlobSortEx_Clear_Buffer_IMP(BlobSortEx *self) { BlobSortExIVARS *const ivars = BlobSortEx_IVARS(self); ivars->mem_consumed = 0; BlobSortEx_Clear_Buffer_t super_clear_buffer = SUPER_METHOD_PTR(BLOBSORTEX, LUCY_BlobSortEx_Clear_Buffer); super_clear_buffer(self); }
bool BlobType_Equals_IMP(BlobType *self, Obj *other) { if ((BlobType*)other == self) { return true; } if (!Obj_Is_A(other, BLOBTYPE)) { return false; } BlobType_Equals_t super_equals = (BlobType_Equals_t)SUPER_METHOD_PTR(BLOBTYPE, LUCY_BlobType_Equals); return super_equals(self, other); }
Obj* NoMatchQuery_dump(NoMatchQuery *self) { NoMatchQuery_Dump_t super_dump = SUPER_METHOD_PTR(NOMATCHQUERY, Lucy_NoMatchQuery_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); Hash_Store_Str(dump, "fails_to_match", 14, (Obj*)Bool_singleton(self->fails_to_match)); return (Obj*)dump; }
bool_t Int64Type_equals(Int64Type *self, Obj *other) { if (self == (Int64Type*)other) { return true; } if (!other) { return false; } if (!Obj_Is_A(other, INT64TYPE)) { return false; } Int64Type_Equals_t super_equals = SUPER_METHOD_PTR(INT64TYPE, Lucy_Int64Type_Equals); return super_equals(self, other); }
bool_t Float32Type_equals(Float32Type *self, Obj *other) { if (self == (Float32Type*)other) { return true; } if (!other) { return false; } if (!Obj_Is_A(other, FLOAT32TYPE)) { return false; } Float32Type_Equals_t super_equals = SUPER_METHOD_PTR(FLOAT32TYPE, Lucy_Float32Type_Equals); return super_equals(self, other); }
bool Int64Type_Equals_IMP(Int64Type *self, Obj *other) { if (self == (Int64Type*)other) { return true; } if (!other) { return false; } if (!Obj_is_a(other, INT64TYPE)) { return false; } Int64Type_Equals_t super_equals = SUPER_METHOD_PTR(INT64TYPE, LUCY_Int64Type_Equals); return super_equals(self, other); }
HitDoc* HitDoc_Deserialize_IMP(HitDoc *self, InStream *instream) { HitDoc_Deserialize_t super_deserialize = SUPER_METHOD_PTR(HITDOC, LUCY_HitDoc_Deserialize); self = super_deserialize(self, instream); HitDocIVARS *const ivars = HitDoc_IVARS(self); ivars->score = InStream_Read_F32(instream); return self; }
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; }
void PolyCompiler_Serialize_IMP(PolyCompiler *self, OutStream *outstream) { PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self); Freezer_serialize_string(PolyCompiler_get_class_name(self), outstream); Freezer_serialize_varray(ivars->children, outstream); PolyCompiler_Serialize_t super_serialize = SUPER_METHOD_PTR(POLYCOMPILER, LUCY_PolyCompiler_Serialize); super_serialize(self, outstream); }
Hash* HitDoc_Dump_IMP(HitDoc *self) { HitDocIVARS *const ivars = HitDoc_IVARS(self); HitDoc_Dump_t super_dump = SUPER_METHOD_PTR(HITDOC, LUCY_HitDoc_Dump); Hash *dump = super_dump(self); Hash_Store_Utf8(dump, "score", 5, (Obj*)Str_newf("%f64", ivars->score)); return dump; }
Hash* SnowStemmer_Dump_IMP(SnowballStemmer *self) { SnowballStemmerIVARS *const ivars = SnowStemmer_IVARS(self); SnowStemmer_Dump_t super_dump = SUPER_METHOD_PTR(SNOWBALLSTEMMER, LUCY_SnowStemmer_Dump); Hash *dump = super_dump(self); Hash_Store_Utf8(dump, "language", 8, (Obj*)Str_Clone(ivars->language)); return dump; }
Hash* EasyAnalyzer_dump(EasyAnalyzer *self) { EasyAnalyzerIVARS *const ivars = EasyAnalyzer_IVARS(self); EasyAnalyzer_Dump_t super_dump = SUPER_METHOD_PTR(EASYANALYZER, Lucy_EasyAnalyzer_Dump); Hash *dump = super_dump(self); Hash_Store_Str(dump, "language", 8, (Obj*)CB_Clone(ivars->language)); return dump; }
void CFReader_Set_Path_IMP(CompoundFileReader *self, String *path) { CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self); Folder_Set_Path(ivars->real_folder, path); CFReader_Set_Path_t super_set_path = (CFReader_Set_Path_t)SUPER_METHOD_PTR(COMPOUNDFILEREADER, LUCY_CFReader_Set_Path); super_set_path(self, path); }
Obj* RegexTokenizer_Dump_IMP(RegexTokenizer *self) { RegexTokenizerIVARS *const ivars = RegexTokenizer_IVARS(self); RegexTokenizer_Dump_t super_dump = SUPER_METHOD_PTR(REGEXTOKENIZER, LUCY_RegexTokenizer_Dump); Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH); Hash_Store_Utf8(dump, "pattern", 7, (Obj*)Str_Clone(ivars->pattern)); return (Obj*)dump; }
bool StringType_Equals_IMP(StringType *self, Obj *other) { if ((StringType*)other == self) { return true; } StringType_Equals_t super_equals = (StringType_Equals_t)SUPER_METHOD_PTR(STRINGTYPE, LUCY_StringType_Equals); if (!super_equals(self, other)) { return false; } return true; }
bool Float32Type_Equals_IMP(Float32Type *self, Obj *other) { if (self == (Float32Type*)other) { return true; } if (!other) { return false; } if (!Obj_is_a(other, FLOAT32TYPE)) { return false; } Float32Type_Equals_t super_equals = SUPER_METHOD_PTR(FLOAT32TYPE, LUCY_Float32Type_Equals); return super_equals(self, other); }
EasyAnalyzer* EasyAnalyzer_load(EasyAnalyzer *self, Obj *dump) { EasyAnalyzer_Load_t super_load = SUPER_METHOD_PTR(EASYANALYZER, Lucy_EasyAnalyzer_Load); EasyAnalyzer *loaded = super_load(self, dump); Hash *source = (Hash*)CERTIFY(dump, HASH); CharBuf *language = (CharBuf*)CERTIFY(Hash_Fetch_Str(source, "language", 8), CHARBUF); return EasyAnalyzer_init(loaded, language); }
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; }
RegexTokenizer* RegexTokenizer_Load_IMP(RegexTokenizer *self, Obj *dump) { Hash *source = (Hash*)CERTIFY(dump, HASH); RegexTokenizer_Load_t super_load = SUPER_METHOD_PTR(REGEXTOKENIZER, LUCY_RegexTokenizer_Load); RegexTokenizer *loaded = super_load(self, dump); String *pattern = (String*)CERTIFY(Hash_Fetch_Utf8(source, "pattern", 7), STRING); return RegexTokenizer_init(loaded, pattern); }
NoMatchQuery* NoMatchQuery_load(NoMatchQuery *self, Obj *dump) { Hash *source = (Hash*)CERTIFY(dump, HASH); NoMatchQuery_Load_t super_load = SUPER_METHOD_PTR(NOMATCHQUERY, Lucy_NoMatchQuery_Load); NoMatchQuery *loaded = super_load(self, dump); Obj *fails = Cfish_Hash_Fetch_Str(source, "fails_to_match", 14); loaded->fails_to_match = fails ? Obj_To_Bool(fails) : true; return loaded; }
PolyCompiler* PolyCompiler_Deserialize_IMP(PolyCompiler *self, InStream *instream) { PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self); String *class_name = Freezer_read_string(instream); DECREF(class_name); // TODO Don't serialize class name. ivars->children = Freezer_read_varray(instream); PolyCompiler_Deserialize_t super_deserialize = SUPER_METHOD_PTR(POLYCOMPILER, LUCY_PolyCompiler_Deserialize); return super_deserialize(self, instream); }
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; }
SnowballStemmer* SnowStemmer_Load_IMP(SnowballStemmer *self, Obj *dump) { SnowStemmer_Load_t super_load = SUPER_METHOD_PTR(SNOWBALLSTEMMER, LUCY_SnowStemmer_Load); SnowballStemmer *loaded = super_load(self, dump); Hash *source = (Hash*)CERTIFY(dump, HASH); String *language = (String*)CERTIFY(Hash_Fetch_Utf8(source, "language", 8), STRING); return SnowStemmer_init(loaded, language); }