http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/Indexer.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Indexer.c b/core/Lucy/Index/Indexer.c index 8840bbe..efaec72 100644 --- a/core/Lucy/Index/Indexer.c +++ b/core/Lucy/Index/Indexer.c @@ -194,9 +194,9 @@ Indexer_init(Indexer *self, Schema *schema, Obj *index, ivars->segment = Seg_new(new_seg_num); // Add all known fields to Segment. - VArray *fields = Schema_All_Fields(schema); - for (uint32_t i = 0, max = VA_Get_Size(fields); i < max; i++) { - Seg_Add_Field(ivars->segment, (String*)VA_Fetch(fields, i)); + Vector *fields = Schema_All_Fields(schema); + for (uint32_t i = 0, max = Vec_Get_Size(fields); i < max; i++) { + Seg_Add_Field(ivars->segment, (String*)Vec_Fetch(fields, i)); } DECREF(fields); @@ -288,8 +288,8 @@ Indexer_Delete_By_Term_IMP(Indexer *self, String *field, Obj *term) { if (FType_Is_A(type, FULLTEXTTYPE)) { CERTIFY(term, STRING); Analyzer *analyzer = Schema_Fetch_Analyzer(schema, field); - VArray *terms = Analyzer_Split(analyzer, (String*)term); - Obj *analyzed_term = VA_Fetch(terms, 0); + Vector *terms = Analyzer_Split(analyzer, (String*)term); + Obj *analyzed_term = Vec_Fetch(terms, 0); if (analyzed_term) { DelWriter_Delete_By_Term(ivars->del_writer, field, analyzed_term); @@ -336,22 +336,22 @@ Indexer_Add_Index_IMP(Indexer *self, Obj *index) { else { Schema *schema = ivars->schema; Schema *other_schema = IxReader_Get_Schema(reader); - VArray *other_fields = Schema_All_Fields(other_schema); - VArray *seg_readers = IxReader_Seg_Readers(reader); + Vector *other_fields = Schema_All_Fields(other_schema); + Vector *seg_readers = IxReader_Seg_Readers(reader); // Validate schema compatibility and add fields. Schema_Eat(schema, other_schema); // Add fields to Segment. - for (uint32_t i = 0, max = VA_Get_Size(other_fields); i < max; i++) { - String *other_field = (String*)VA_Fetch(other_fields, i); + for (uint32_t i = 0, max = Vec_Get_Size(other_fields); i < max; i++) { + String *other_field = (String*)Vec_Fetch(other_fields, i); Seg_Add_Field(ivars->segment, other_field); } DECREF(other_fields); // Add all segments. - for (uint32_t i = 0, max = VA_Get_Size(seg_readers); i < max; i++) { - SegReader *seg_reader = (SegReader*)VA_Fetch(seg_readers, i); + for (uint32_t i = 0, max = Vec_Get_Size(seg_readers); i < max; i++) { + SegReader *seg_reader = (SegReader*)Vec_Fetch(seg_readers, i); DeletionsReader *del_reader = (DeletionsReader*)SegReader_Fetch( seg_reader, Class_Get_Name(DELETIONSREADER)); @@ -380,10 +380,10 @@ Indexer_Optimize_IMP(Indexer *self) { static String* S_find_schema_file(Snapshot *snapshot) { - VArray *files = Snapshot_List(snapshot); + Vector *files = Snapshot_List(snapshot); String *retval = NULL; - for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) { - String *file = (String*)VA_Fetch(files, i); + for (uint32_t i = 0, max = Vec_Get_Size(files); i < max; i++) { + String *file = (String*)Vec_Fetch(files, i); if (Str_Starts_With_Utf8(file, "schema_", 7) && Str_Ends_With_Utf8(file, ".json", 5) ) { @@ -396,10 +396,10 @@ S_find_schema_file(Snapshot *snapshot) { } static bool -S_maybe_merge(Indexer *self, VArray *seg_readers) { +S_maybe_merge(Indexer *self, Vector *seg_readers) { IndexerIVARS *const ivars = Indexer_IVARS(self); bool merge_happened = false; - uint32_t num_seg_readers = VA_Get_Size(seg_readers); + uint32_t num_seg_readers = Vec_Get_Size(seg_readers); Lock *merge_lock = IxManager_Make_Merge_Lock(ivars->manager); bool got_merge_lock = Lock_Obtain(merge_lock); int64_t cutoff; @@ -429,13 +429,13 @@ S_maybe_merge(Indexer *self, VArray *seg_readers) { // Get a list of segments to recycle. Validate and confirm that there are // no dupes in the list. - VArray *to_merge = IxManager_Recycle(ivars->manager, ivars->polyreader, + Vector *to_merge = IxManager_Recycle(ivars->manager, ivars->polyreader, ivars->del_writer, cutoff, ivars->optimize); - Hash *seen = Hash_new(VA_Get_Size(to_merge)); - for (uint32_t i = 0, max = VA_Get_Size(to_merge); i < max; i++) { + Hash *seen = Hash_new(Vec_Get_Size(to_merge)); + for (uint32_t i = 0, max = Vec_Get_Size(to_merge); i < max; i++) { SegReader *seg_reader - = (SegReader*)CERTIFY(VA_Fetch(to_merge, i), SEGREADER); + = (SegReader*)CERTIFY(Vec_Fetch(to_merge, i), SEGREADER); String *seg_name = SegReader_Get_Seg_Name(seg_reader); if (Hash_Fetch(seen, seg_name)) { DECREF(seen); @@ -448,8 +448,8 @@ S_maybe_merge(Indexer *self, VArray *seg_readers) { DECREF(seen); // Consolidate segments if either sparse or optimizing forced. - for (uint32_t i = 0, max = VA_Get_Size(to_merge); i < max; i++) { - SegReader *seg_reader = (SegReader*)VA_Fetch(to_merge, i); + for (uint32_t i = 0, max = Vec_Get_Size(to_merge); i < max; i++) { + SegReader *seg_reader = (SegReader*)Vec_Fetch(to_merge, i); int64_t seg_num = SegReader_Get_Seg_Num(seg_reader); Matcher *deletions = DelWriter_Seg_Deletions(ivars->del_writer, seg_reader); @@ -470,7 +470,7 @@ S_maybe_merge(Indexer *self, VArray *seg_readers) { // Write out new deletions. if (DelWriter_Updated(ivars->del_writer)) { // Only write out if they haven't all been applied. - if (VA_Get_Size(to_merge) != num_seg_readers) { + if (Vec_Get_Size(to_merge) != num_seg_readers) { DelWriter_Finish(ivars->del_writer); } } @@ -482,8 +482,8 @@ S_maybe_merge(Indexer *self, VArray *seg_readers) { void Indexer_Prepare_Commit_IMP(Indexer *self) { IndexerIVARS *const ivars = Indexer_IVARS(self); - VArray *seg_readers = PolyReader_Get_Seg_Readers(ivars->polyreader); - uint32_t num_seg_readers = VA_Get_Size(seg_readers); + Vector *seg_readers = PolyReader_Get_Seg_Readers(ivars->polyreader); + uint32_t num_seg_readers = Vec_Get_Size(seg_readers); bool merge_happened = false; if (!ivars->write_lock || ivars->prepared) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/Inverter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Inverter.c b/core/Lucy/Index/Inverter.c index c48d71d..dc356b6 100644 --- a/core/Lucy/Index/Inverter.c +++ b/core/Lucy/Index/Inverter.c @@ -50,8 +50,8 @@ Inverter_init(Inverter *self, Schema *schema, Segment *segment) { ivars->current = ivars->blank; // Derive. - ivars->entry_pool = VA_new(Schema_Num_Fields(schema)); - ivars->entries = VA_new(Schema_Num_Fields(schema)); + ivars->entry_pool = Vec_new(Schema_Num_Fields(schema)); + ivars->entries = Vec_new(Schema_Num_Fields(schema)); // Assign. ivars->schema = (Schema*)INCREF(schema); @@ -77,16 +77,16 @@ Inverter_Iterate_IMP(Inverter *self) { InverterIVARS *const ivars = Inverter_IVARS(self); ivars->tick = -1; if (!ivars->sorted) { - VA_Sort(ivars->entries); + Vec_Sort(ivars->entries); ivars->sorted = true; } - return VA_Get_Size(ivars->entries); + return Vec_Get_Size(ivars->entries); } int32_t Inverter_Next_IMP(Inverter *self) { InverterIVARS *const ivars = Inverter_IVARS(self); - ivars->current = (InverterEntry*)VA_Fetch(ivars->entries, ++ivars->tick); + ivars->current = (InverterEntry*)Vec_Fetch(ivars->entries, ++ivars->tick); if (!ivars->current) { ivars->current = ivars->blank; } // Exhausted. return InvEntry_IVARS(ivars->current)->field_num; } @@ -175,17 +175,17 @@ Inverter_Add_Field_IMP(Inverter *self, InverterEntry *entry) { } // Prime the iterator. - VA_Push(ivars->entries, INCREF(entry)); + Vec_Push(ivars->entries, INCREF(entry)); ivars->sorted = false; } void Inverter_Clear_IMP(Inverter *self) { InverterIVARS *const ivars = Inverter_IVARS(self); - for (uint32_t i = 0, max = VA_Get_Size(ivars->entries); i < max; i++) { - InvEntry_Clear(VA_Fetch(ivars->entries, i)); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->entries); i < max; i++) { + InvEntry_Clear(Vec_Fetch(ivars->entries, i)); } - VA_Clear(ivars->entries); + Vec_Clear(ivars->entries); ivars->tick = -1; DECREF(ivars->doc); ivars->doc = NULL; http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/Inverter.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Inverter.cfh b/core/Lucy/Index/Inverter.cfh index 3463043..13012a5 100644 --- a/core/Lucy/Index/Inverter.cfh +++ b/core/Lucy/Index/Inverter.cfh @@ -28,8 +28,8 @@ class Lucy::Index::Inverter inherits Clownfish::Obj { Schema *schema; Segment *segment; Doc *doc; - VArray *entries; /* Entries for the current Doc. */ - VArray *entry_pool; /* Cached entry per field. */ + Vector *entries; /* Entries for the current Doc. */ + Vector *entry_pool; /* Cached entry per field. */ InverterEntry *current; /* Current entry while iterating. */ InverterEntry *blank; /* Used when iterator is exhausted. */ float boost; http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/LexIndex.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/LexIndex.c b/core/Lucy/Index/LexIndex.c index 91e8d03..7cbe022 100644 --- a/core/Lucy/Index/LexIndex.c +++ b/core/Lucy/Index/LexIndex.c @@ -158,7 +158,7 @@ LexIndex_Seek_IMP(LexIndex *self, Obj *target) { Obj_Get_Class_Name(target), Class_Get_Name(STRING)); } /* TODO: - Obj *first_obj = VA_Fetch(terms, 0); + Obj *first_obj = Vec_Fetch(terms, 0); if (!Obj_Is_A(target, Obj_Get_Class(first_obj))) { THROW(ERR, "Target is a %o, and not comparable to a %o", Obj_Get_Class_Name(target), Obj_Get_Class_Name(first_obj)); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/LexiconReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/LexiconReader.c b/core/Lucy/Index/LexiconReader.c index fd8392a..7450222 100644 --- a/core/Lucy/Index/LexiconReader.c +++ b/core/Lucy/Index/LexiconReader.c @@ -31,7 +31,7 @@ LexiconReader* LexReader_init(LexiconReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick) { + Snapshot *snapshot, Vector *segments, int32_t seg_tick) { DataReader_init((DataReader*)self, schema, folder, snapshot, segments, seg_tick); ABSTRACT_CLASS_CHECK(self, LEXICONREADER); @@ -39,31 +39,31 @@ LexReader_init(LexiconReader *self, Schema *schema, Folder *folder, } LexiconReader* -LexReader_Aggregator_IMP(LexiconReader *self, VArray *readers, +LexReader_Aggregator_IMP(LexiconReader *self, Vector *readers, I32Array *offsets) { UNUSED_VAR(self); return (LexiconReader*)PolyLexReader_new(readers, offsets); } PolyLexiconReader* -PolyLexReader_new(VArray *readers, I32Array *offsets) { +PolyLexReader_new(Vector *readers, I32Array *offsets) { PolyLexiconReader *self = (PolyLexiconReader*)Class_Make_Obj(POLYLEXICONREADER); return PolyLexReader_init(self, readers, offsets); } PolyLexiconReader* -PolyLexReader_init(PolyLexiconReader *self, VArray *readers, +PolyLexReader_init(PolyLexiconReader *self, Vector *readers, I32Array *offsets) { Schema *schema = NULL; - for (uint32_t i = 0, max = VA_Get_Size(readers); i < max; i++) { + for (uint32_t i = 0, max = Vec_Get_Size(readers); i < max; i++) { LexiconReader *reader - = (LexiconReader*)CERTIFY(VA_Fetch(readers, i), LEXICONREADER); + = (LexiconReader*)CERTIFY(Vec_Fetch(readers, i), LEXICONREADER); if (!schema) { schema = LexReader_Get_Schema(reader); } } LexReader_init((LexiconReader*)self, schema, NULL, NULL, NULL, -1); PolyLexiconReaderIVARS *const ivars = PolyLexReader_IVARS(self); - ivars->readers = (VArray*)INCREF(readers); + ivars->readers = (Vector*)INCREF(readers); ivars->offsets = (I32Array*)INCREF(offsets); return self; } @@ -72,12 +72,12 @@ void PolyLexReader_Close_IMP(PolyLexiconReader *self) { PolyLexiconReaderIVARS *const ivars = PolyLexReader_IVARS(self); if (ivars->readers) { - for (uint32_t i = 0, max = VA_Get_Size(ivars->readers); i < max; i++) { + for (uint32_t i = 0, max = Vec_Get_Size(ivars->readers); i < max; i++) { LexiconReader *reader - = (LexiconReader*)VA_Fetch(ivars->readers, i); + = (LexiconReader*)Vec_Fetch(ivars->readers, i); if (reader) { LexReader_Close(reader); } } - VA_Clear(ivars->readers); + Vec_Clear(ivars->readers); } } @@ -116,8 +116,8 @@ PolyLexReader_Doc_Freq_IMP(PolyLexiconReader *self, String *field, Obj *term) { PolyLexiconReaderIVARS *const ivars = PolyLexReader_IVARS(self); uint32_t doc_freq = 0; - for (uint32_t i = 0, max = VA_Get_Size(ivars->readers); i < max; i++) { - LexiconReader *reader = (LexiconReader*)VA_Fetch(ivars->readers, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->readers); i < max; i++) { + LexiconReader *reader = (LexiconReader*)Vec_Fetch(ivars->readers, i); if (reader) { doc_freq += LexReader_Doc_Freq(reader, field, term); } @@ -127,7 +127,7 @@ PolyLexReader_Doc_Freq_IMP(PolyLexiconReader *self, String *field, DefaultLexiconReader* DefLexReader_new(Schema *schema, Folder *folder, Snapshot *snapshot, - VArray *segments, int32_t seg_tick) { + Vector *segments, int32_t seg_tick) { DefaultLexiconReader *self = (DefaultLexiconReader*)Class_Make_Obj(DEFAULTLEXICONREADER); return DefLexReader_init(self, schema, folder, snapshot, segments, @@ -158,7 +158,7 @@ S_has_data(Schema *schema, Folder *folder, Segment *segment, String *field) { DefaultLexiconReader* DefLexReader_init(DefaultLexiconReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick) { + Snapshot *snapshot, Vector *segments, int32_t seg_tick) { // Init. LexReader_init((LexiconReader*)self, schema, folder, snapshot, segments, @@ -167,12 +167,12 @@ DefLexReader_init(DefaultLexiconReader *self, Schema *schema, Folder *folder, Segment *segment = DefLexReader_Get_Segment(self); // Build an array of SegLexicon objects. - ivars->lexicons = VA_new(Schema_Num_Fields(schema)); + ivars->lexicons = Vec_new(Schema_Num_Fields(schema)); for (uint32_t i = 1, max = Schema_Num_Fields(schema) + 1; i < max; i++) { String *field = Seg_Field_Name(segment, i); if (field && S_has_data(schema, folder, segment, field)) { SegLexicon *lexicon = SegLex_new(schema, folder, segment, field); - VA_Store(ivars->lexicons, i, (Obj*)lexicon); + Vec_Store(ivars->lexicons, i, (Obj*)lexicon); } } @@ -198,7 +198,7 @@ DefLexReader_Lexicon_IMP(DefaultLexiconReader *self, String *field, Obj *term) { DefaultLexiconReaderIVARS *const ivars = DefLexReader_IVARS(self); int32_t field_num = Seg_Field_Num(ivars->segment, field); - SegLexicon *orig = (SegLexicon*)VA_Fetch(ivars->lexicons, field_num); + SegLexicon *orig = (SegLexicon*)Vec_Fetch(ivars->lexicons, field_num); SegLexicon *lexicon = NULL; if (orig) { // i.e. has data @@ -216,7 +216,7 @@ S_find_tinfo(DefaultLexiconReader *self, String *field, Obj *target) { if (field != NULL && target != NULL) { int32_t field_num = Seg_Field_Num(ivars->segment, field); SegLexicon *lexicon - = (SegLexicon*)VA_Fetch(ivars->lexicons, field_num); + = (SegLexicon*)Vec_Fetch(ivars->lexicons, field_num); if (lexicon) { // Iterate until the result is ge the term. http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/LexiconReader.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/LexiconReader.cfh b/core/Lucy/Index/LexiconReader.cfh index f98416a..916d70f 100644 --- a/core/Lucy/Index/LexiconReader.cfh +++ b/core/Lucy/Index/LexiconReader.cfh @@ -25,7 +25,7 @@ public abstract class Lucy::Index::LexiconReader nickname LexReader inert LexiconReader* init(LexiconReader *self, Schema *schema = NULL, Folder *folder = NULL, - Snapshot *snapshot = NULL, VArray *segments = NULL, + Snapshot *snapshot = NULL, Vector *segments = NULL, int32_t seg_tick = -1); /** Return a new Lexicon for the given `field`. Will return @@ -56,20 +56,20 @@ public abstract class Lucy::Index::LexiconReader nickname LexReader * @param offsets Doc id start offsets for each reader. */ public incremented nullable LexiconReader* - Aggregator(LexiconReader *self, VArray *readers, I32Array *offsets); + Aggregator(LexiconReader *self, Vector *readers, I32Array *offsets); } class Lucy::Index::PolyLexiconReader nickname PolyLexReader inherits Lucy::Index::LexiconReader { - VArray *readers; + Vector *readers; I32Array *offsets; inert incremented PolyLexiconReader* - new(VArray *readers, I32Array *offsets); + new(Vector *readers, I32Array *offsets); inert PolyLexiconReader* - init(PolyLexiconReader *self, VArray *readers, I32Array *offsets); + init(PolyLexiconReader *self, Vector *readers, I32Array *offsets); public incremented nullable Lexicon* Lexicon(PolyLexiconReader *self, String *field, Obj *term = NULL); @@ -87,15 +87,15 @@ class Lucy::Index::PolyLexiconReader nickname PolyLexReader class Lucy::Index::DefaultLexiconReader nickname DefLexReader inherits Lucy::Index::LexiconReader { - VArray *lexicons; + Vector *lexicons; inert incremented DefaultLexiconReader* - new(Schema *schema, Folder *folder, Snapshot *snapshot, VArray *segments, + new(Schema *schema, Folder *folder, Snapshot *snapshot, Vector *segments, int32_t seg_tick); inert DefaultLexiconReader* init(DefaultLexiconReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick); + Snapshot *snapshot, Vector *segments, int32_t seg_tick); public incremented nullable Lexicon* Lexicon(DefaultLexiconReader *self, String *field, http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PolyLexicon.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PolyLexicon.c b/core/Lucy/Index/PolyLexicon.c index d8572bb..42ebb0c 100644 --- a/core/Lucy/Index/PolyLexicon.c +++ b/core/Lucy/Index/PolyLexicon.c @@ -26,18 +26,18 @@ // Empty out, then refill the Queue, seeking all elements to [target]. static void -S_refresh_lex_q(SegLexQueue *lex_q, VArray *seg_lexicons, Obj *target); +S_refresh_lex_q(SegLexQueue *lex_q, Vector *seg_lexicons, Obj *target); PolyLexicon* -PolyLex_new(String *field, VArray *sub_readers) { +PolyLex_new(String *field, Vector *sub_readers) { PolyLexicon *self = (PolyLexicon*)Class_Make_Obj(POLYLEXICON); return PolyLex_init(self, field, sub_readers); } PolyLexicon* -PolyLex_init(PolyLexicon *self, String *field, VArray *sub_readers) { - uint32_t num_sub_readers = VA_Get_Size(sub_readers); - VArray *seg_lexicons = VA_new(num_sub_readers); +PolyLex_init(PolyLexicon *self, String *field, Vector *sub_readers) { + uint32_t num_sub_readers = Vec_Get_Size(sub_readers); + Vector *seg_lexicons = Vec_new(num_sub_readers); // Init. Lex_init((Lexicon*)self, field); @@ -47,11 +47,11 @@ PolyLex_init(PolyLexicon *self, String *field, VArray *sub_readers) { // Derive. for (uint32_t i = 0; i < num_sub_readers; i++) { - LexiconReader *lex_reader = (LexiconReader*)VA_Fetch(sub_readers, i); + LexiconReader *lex_reader = (LexiconReader*)Vec_Fetch(sub_readers, i); if (lex_reader && CERTIFY(lex_reader, LEXICONREADER)) { Lexicon *seg_lexicon = LexReader_Lexicon(lex_reader, field, NULL); if (seg_lexicon != NULL) { - VA_Push(seg_lexicons, (Obj*)seg_lexicon); + Vec_Push(seg_lexicons, (Obj*)seg_lexicon); } } } @@ -72,7 +72,7 @@ PolyLex_Destroy_IMP(PolyLexicon *self) { } static void -S_refresh_lex_q(SegLexQueue *lex_q, VArray *seg_lexicons, Obj *target) { +S_refresh_lex_q(SegLexQueue *lex_q, Vector *seg_lexicons, Obj *target) { // Empty out the queue. while (1) { SegLexicon *seg_lex = (SegLexicon*)SegLexQ_Pop(lex_q); @@ -81,9 +81,9 @@ S_refresh_lex_q(SegLexQueue *lex_q, VArray *seg_lexicons, Obj *target) { } // Refill the queue. - for (uint32_t i = 0, max = VA_Get_Size(seg_lexicons); i < max; i++) { + for (uint32_t i = 0, max = Vec_Get_Size(seg_lexicons); i < max; i++) { SegLexicon *const seg_lexicon - = (SegLexicon*)VA_Fetch(seg_lexicons, i); + = (SegLexicon*)Vec_Fetch(seg_lexicons, i); SegLex_Seek(seg_lexicon, target); if (SegLex_Get_Term(seg_lexicon) != NULL) { SegLexQ_Insert(lex_q, INCREF(seg_lexicon)); @@ -94,8 +94,8 @@ S_refresh_lex_q(SegLexQueue *lex_q, VArray *seg_lexicons, Obj *target) { void PolyLex_Reset_IMP(PolyLexicon *self) { PolyLexiconIVARS *const ivars = PolyLex_IVARS(self); - VArray *seg_lexicons = ivars->seg_lexicons; - uint32_t num_segs = VA_Get_Size(seg_lexicons); + Vector *seg_lexicons = ivars->seg_lexicons; + uint32_t num_segs = Vec_Get_Size(seg_lexicons); SegLexQueue *lex_q = ivars->lex_q; // Empty out the queue. @@ -108,7 +108,7 @@ PolyLex_Reset_IMP(PolyLexicon *self) { // Fill the queue with valid SegLexicons. for (uint32_t i = 0; i < num_segs; i++) { SegLexicon *const seg_lexicon - = (SegLexicon*)VA_Fetch(seg_lexicons, i); + = (SegLexicon*)Vec_Fetch(seg_lexicons, i); SegLex_Reset(seg_lexicon); if (SegLex_Next(seg_lexicon)) { SegLexQ_Insert(ivars->lex_q, INCREF(seg_lexicon)); @@ -157,7 +157,7 @@ PolyLex_Next_IMP(PolyLexicon *self) { void PolyLex_Seek_IMP(PolyLexicon *self, Obj *target) { PolyLexiconIVARS *const ivars = PolyLex_IVARS(self); - VArray *seg_lexicons = ivars->seg_lexicons; + Vector *seg_lexicons = ivars->seg_lexicons; SegLexQueue *lex_q = ivars->lex_q; if (target == NULL) { @@ -192,7 +192,7 @@ PolyLex_Get_Term_IMP(PolyLexicon *self) { uint32_t PolyLex_Get_Num_Seg_Lexicons_IMP(PolyLexicon *self) { PolyLexiconIVARS *const ivars = PolyLex_IVARS(self); - return VA_Get_Size(ivars->seg_lexicons); + return Vec_Get_Size(ivars->seg_lexicons); } SegLexQueue* http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PolyLexicon.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PolyLexicon.cfh b/core/Lucy/Index/PolyLexicon.cfh index 2700753..e962b03 100644 --- a/core/Lucy/Index/PolyLexicon.cfh +++ b/core/Lucy/Index/PolyLexicon.cfh @@ -26,14 +26,14 @@ class Lucy::Index::PolyLexicon nickname PolyLex Obj *term; SegLexQueue *lex_q; - VArray *seg_lexicons; + Vector *seg_lexicons; int32_t size; inert incremented PolyLexicon* - new(String *field, VArray *sub_readers); + new(String *field, Vector *sub_readers); inert PolyLexicon* - init(PolyLexicon *self, String *field, VArray *sub_readers); + init(PolyLexicon *self, String *field, Vector *sub_readers); public void Seek(PolyLexicon *self, Obj *target = NULL); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PolyReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PolyReader.c b/core/Lucy/Index/PolyReader.c index 7aa8eeb..b3af7fa 100644 --- a/core/Lucy/Index/PolyReader.c +++ b/core/Lucy/Index/PolyReader.c @@ -48,7 +48,7 @@ S_release_deletion_lock(PolyReader *self); // Try to open all SegReaders. struct try_open_elements_context { PolyReader *self; - VArray *seg_readers; + Vector *seg_readers; }; void S_try_open_elements(void *context); @@ -67,7 +67,7 @@ struct try_open_segreader_context { Schema *schema; Folder *folder; Snapshot *snapshot; - VArray *segments; + Vector *segments; int32_t seg_tick; SegReader *result; }; @@ -79,7 +79,7 @@ S_derive_folder(Obj *index); PolyReader* PolyReader_new(Schema *schema, Folder *folder, Snapshot *snapshot, - IndexManager *manager, VArray *sub_readers) { + IndexManager *manager, Vector *sub_readers) { PolyReader *self = (PolyReader*)Class_Make_Obj(POLYREADER); return PolyReader_init(self, schema, folder, snapshot, manager, sub_readers); @@ -92,29 +92,29 @@ PolyReader_open(Obj *index, Snapshot *snapshot, IndexManager *manager) { } static Obj* -S_first_non_null(VArray *array) { - for (uint32_t i = 0, max = VA_Get_Size(array); i < max; i++) { - Obj *thing = VA_Fetch(array, i); +S_first_non_null(Vector *array) { + for (uint32_t i = 0, max = Vec_Get_Size(array); i < max; i++) { + Obj *thing = Vec_Fetch(array, i); if (thing) { return thing; } } return NULL; } static void -S_init_sub_readers(PolyReader *self, VArray *sub_readers) { +S_init_sub_readers(PolyReader *self, Vector *sub_readers) { PolyReaderIVARS *const ivars = PolyReader_IVARS(self); - uint32_t num_sub_readers = VA_Get_Size(sub_readers); + uint32_t num_sub_readers = Vec_Get_Size(sub_readers); int32_t *starts = (int32_t*)MALLOCATE(num_sub_readers * sizeof(int32_t)); Hash *data_readers = Hash_new(0); DECREF(ivars->sub_readers); DECREF(ivars->offsets); - ivars->sub_readers = (VArray*)INCREF(sub_readers); + ivars->sub_readers = (Vector*)INCREF(sub_readers); // Accumulate doc_max, subreader start offsets, and DataReaders. ivars->doc_max = 0; for (uint32_t i = 0; i < num_sub_readers; i++) { - SegReader *seg_reader = (SegReader*)VA_Fetch(sub_readers, i); + SegReader *seg_reader = (SegReader*)Vec_Fetch(sub_readers, i); Hash *components = SegReader_Get_Components(seg_reader); starts[i] = ivars->doc_max; ivars->doc_max += SegReader_Doc_Max(seg_reader); @@ -122,12 +122,12 @@ S_init_sub_readers(PolyReader *self, VArray *sub_readers) { while (HashIter_Next(iter)) { String *api = HashIter_Get_Key(iter); DataReader *component = (DataReader*)HashIter_Get_Value(iter); - VArray *readers = (VArray*)Hash_Fetch(data_readers, api); + Vector *readers = (Vector*)Hash_Fetch(data_readers, api); if (!readers) { - readers = VA_new(num_sub_readers); + readers = Vec_new(num_sub_readers); Hash_Store(data_readers, api, (Obj*)readers); } - VA_Store(readers, i, INCREF(component)); + Vec_Store(readers, i, INCREF(component)); } DECREF(iter); } @@ -136,7 +136,7 @@ S_init_sub_readers(PolyReader *self, VArray *sub_readers) { HashIterator *iter = HashIter_new(data_readers); while (HashIter_Next(iter)) { String *api = HashIter_Get_Key(iter); - VArray *readers = (VArray*)HashIter_Get_Value(iter); + Vector *readers = (Vector*)HashIter_Get_Value(iter); DataReader *datareader = (DataReader*)CERTIFY(S_first_non_null(readers), DATAREADER); DataReader *aggregator @@ -158,18 +158,18 @@ S_init_sub_readers(PolyReader *self, VArray *sub_readers) { PolyReader* PolyReader_init(PolyReader *self, Schema *schema, Folder *folder, Snapshot *snapshot, IndexManager *manager, - VArray *sub_readers) { + Vector *sub_readers) { PolyReaderIVARS *const ivars = PolyReader_IVARS(self); ivars->doc_max = 0; ivars->del_count = 0; if (sub_readers) { - uint32_t num_segs = VA_Get_Size(sub_readers); - VArray *segments = VA_new(num_segs); + uint32_t num_segs = Vec_Get_Size(sub_readers); + Vector *segments = Vec_new(num_segs); for (uint32_t i = 0; i < num_segs; i++) { SegReader *seg_reader - = (SegReader*)CERTIFY(VA_Fetch(sub_readers, i), SEGREADER); - VA_Push(segments, INCREF(SegReader_Get_Segment(seg_reader))); + = (SegReader*)CERTIFY(Vec_Fetch(sub_readers, i), SEGREADER); + Vec_Push(segments, INCREF(SegReader_Get_Segment(seg_reader))); } IxReader_init((IndexReader*)self, schema, folder, snapshot, segments, -1, manager); @@ -179,7 +179,7 @@ PolyReader_init(PolyReader *self, Schema *schema, Folder *folder, else { IxReader_init((IndexReader*)self, schema, folder, snapshot, NULL, -1, manager); - ivars->sub_readers = VA_new(0); + ivars->sub_readers = Vec_new(0); ivars->offsets = I32Arr_new_steal(NULL, 0); } @@ -191,8 +191,8 @@ PolyReader_Close_IMP(PolyReader *self) { PolyReaderIVARS *const ivars = PolyReader_IVARS(self); PolyReader_Close_t super_close = SUPER_METHOD_PTR(POLYREADER, LUCY_PolyReader_Close); - for (uint32_t i = 0, max = VA_Get_Size(ivars->sub_readers); i < max; i++) { - SegReader *seg_reader = (SegReader*)VA_Fetch(ivars->sub_readers, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->sub_readers); i < max; i++) { + SegReader *seg_reader = (SegReader*)Vec_Fetch(ivars->sub_readers, i); SegReader_Close(seg_reader); } super_close(self); @@ -227,15 +227,15 @@ S_try_open_elements(void *context) { = (struct try_open_elements_context*)context; PolyReader *self = args->self; PolyReaderIVARS *const ivars = PolyReader_IVARS(self); - VArray *files = Snapshot_List(ivars->snapshot); + Vector *files = Snapshot_List(ivars->snapshot); Folder *folder = PolyReader_Get_Folder(self); uint32_t num_segs = 0; uint64_t latest_schema_gen = 0; String *schema_file = NULL; // Find schema file, count segments. - for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) { - String *entry = (String*)VA_Fetch(files, i); + for (uint32_t i = 0, max = Vec_Get_Size(files); i < max; i++) { + String *entry = (String*)Vec_Fetch(files, i); if (Seg_valid_seg_name(entry)) { num_segs++; @@ -271,9 +271,9 @@ S_try_open_elements(void *context) { } } - VArray *segments = VA_new(num_segs); - for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) { - String *entry = (String*)VA_Fetch(files, i); + Vector *segments = Vec_new(num_segs); + for (uint32_t i = 0, max = Vec_Get_Size(files); i < max; i++) { + String *entry = (String*)Vec_Fetch(files, i); // Create a Segment for each segmeta. if (Seg_valid_seg_name(entry)) { @@ -284,7 +284,7 @@ S_try_open_elements(void *context) { // deleted and a new snapshot file has been written so we need to // retry). if (Seg_Read_File(segment, folder)) { - VA_Push(segments, (Obj*)segment); + Vec_Push(segments, (Obj*)segment); } else { String *mess = MAKE_MESS("Failed to read %o", entry); @@ -297,7 +297,7 @@ S_try_open_elements(void *context) { } // Sort the segments by age. - VA_Sort(segments); + Vec_Sort(segments); // Open individual SegReaders. struct try_open_segreader_context seg_context; @@ -306,7 +306,7 @@ S_try_open_elements(void *context) { seg_context.snapshot = PolyReader_Get_Snapshot(self); seg_context.segments = segments; seg_context.result = NULL; - args->seg_readers = VA_new(num_segs); + args->seg_readers = Vec_new(num_segs); Err *error = NULL; for (uint32_t seg_tick = 0; seg_tick < num_segs; seg_tick++) { seg_context.seg_tick = seg_tick; @@ -314,7 +314,7 @@ S_try_open_elements(void *context) { if (error) { break; } - VA_Push(args->seg_readers, (Obj*)seg_context.result); + Vec_Push(args->seg_readers, (Obj*)seg_context.result); seg_context.result = NULL; } @@ -440,7 +440,7 @@ PolyReader_do_open(PolyReader *self, Obj *index, Snapshot *snapshot, } } else { // Succeeded. - S_init_sub_readers(self, (VArray*)context.seg_readers); + S_init_sub_readers(self, (Vector*)context.seg_readers); DECREF(context.seg_readers); DECREF(target_snap_file); break; @@ -537,13 +537,13 @@ PolyReader_Offsets_IMP(PolyReader *self) { return (I32Array*)INCREF(ivars->offsets); } -VArray* +Vector* PolyReader_Seg_Readers_IMP(PolyReader *self) { PolyReaderIVARS *const ivars = PolyReader_IVARS(self); - return (VArray*)VA_Clone(ivars->sub_readers); + return (Vector*)Vec_Clone(ivars->sub_readers); } -VArray* +Vector* PolyReader_Get_Seg_Readers_IMP(PolyReader *self) { return PolyReader_IVARS(self)->sub_readers; } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PolyReader.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PolyReader.cfh b/core/Lucy/Index/PolyReader.cfh index bae82e1..a118d98 100644 --- a/core/Lucy/Index/PolyReader.cfh +++ b/core/Lucy/Index/PolyReader.cfh @@ -28,7 +28,7 @@ parcel Lucy; */ public class Lucy::Index::PolyReader inherits Lucy::Index::IndexReader { - VArray *sub_readers; + Vector *sub_readers; int32_t doc_max; int32_t del_count; I32Array *offsets; @@ -49,12 +49,12 @@ public class Lucy::Index::PolyReader inherits Lucy::Index::IndexReader { public inert incremented PolyReader* new(Schema *schema = NULL, Folder *folder, Snapshot *snapshot = NULL, - IndexManager *manager = NULL, VArray *sub_readers = NULL); + IndexManager *manager = NULL, Vector *sub_readers = NULL); public inert PolyReader* init(PolyReader *self, Schema *schema = NULL, Folder *folder, Snapshot *snapshot = NULL, IndexManager *manager = NULL, - VArray *sub_readers = NULL); + Vector *sub_readers = NULL); inert String *race_condition_debug1; inert int32_t debug1_num_passes; @@ -76,10 +76,10 @@ public class Lucy::Index::PolyReader inherits Lucy::Index::IndexReader { public incremented I32Array* Offsets(PolyReader *self); - public incremented VArray* + public incremented Vector* Seg_Readers(PolyReader *self); - VArray* + Vector* Get_Seg_Readers(PolyReader *self); public void http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PostingListReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PostingListReader.c b/core/Lucy/Index/PostingListReader.c index 1fdf33a..dbaa171 100644 --- a/core/Lucy/Index/PostingListReader.c +++ b/core/Lucy/Index/PostingListReader.c @@ -32,7 +32,7 @@ PostingListReader* PListReader_init(PostingListReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick) { + Snapshot *snapshot, Vector *segments, int32_t seg_tick) { DataReader_init((DataReader*)self, schema, folder, snapshot, segments, seg_tick); ABSTRACT_CLASS_CHECK(self, POSTINGLISTREADER); @@ -40,7 +40,7 @@ PListReader_init(PostingListReader *self, Schema *schema, Folder *folder, } PostingListReader* -PListReader_Aggregator_IMP(PostingListReader *self, VArray *readers, +PListReader_Aggregator_IMP(PostingListReader *self, Vector *readers, I32Array *offsets) { UNUSED_VAR(self); UNUSED_VAR(readers); @@ -50,7 +50,7 @@ PListReader_Aggregator_IMP(PostingListReader *self, VArray *readers, DefaultPostingListReader* DefPListReader_new(Schema *schema, Folder *folder, Snapshot *snapshot, - VArray *segments, int32_t seg_tick, + Vector *segments, int32_t seg_tick, LexiconReader *lex_reader) { DefaultPostingListReader *self = (DefaultPostingListReader*)Class_Make_Obj(DEFAULTPOSTINGLISTREADER); @@ -60,7 +60,7 @@ DefPListReader_new(Schema *schema, Folder *folder, Snapshot *snapshot, DefaultPostingListReader* DefPListReader_init(DefaultPostingListReader *self, Schema *schema, - Folder *folder, Snapshot *snapshot, VArray *segments, + Folder *folder, Snapshot *snapshot, Vector *segments, int32_t seg_tick, LexiconReader *lex_reader) { PListReader_init((PostingListReader*)self, schema, folder, snapshot, segments, seg_tick); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PostingListReader.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PostingListReader.cfh b/core/Lucy/Index/PostingListReader.cfh index cb8fac8..9bf512c 100644 --- a/core/Lucy/Index/PostingListReader.cfh +++ b/core/Lucy/Index/PostingListReader.cfh @@ -27,7 +27,7 @@ public class Lucy::Index::PostingListReader nickname PListReader inert PostingListReader* init(PostingListReader *self, Schema *schema = NULL, Folder *folder = NULL, Snapshot *snapshot = NULL, - VArray *segments = NULL, int32_t seg_tick = -1); + Vector *segments = NULL, int32_t seg_tick = -1); /** Returns a PostingList, or [](cfish:@null) if either `field` is * [](cfish:@null) or `field` is not present in any documents. @@ -47,7 +47,7 @@ public class Lucy::Index::PostingListReader nickname PListReader * segment level. */ public incremented nullable PostingListReader* - Aggregator(PostingListReader *self, VArray *readers, I32Array *offsets); + Aggregator(PostingListReader *self, Vector *readers, I32Array *offsets); } class Lucy::Index::DefaultPostingListReader nickname DefPListReader @@ -56,12 +56,12 @@ class Lucy::Index::DefaultPostingListReader nickname DefPListReader LexiconReader *lex_reader; inert incremented DefaultPostingListReader* - new(Schema *schema, Folder *folder, Snapshot *snapshot, VArray *segments, + new(Schema *schema, Folder *folder, Snapshot *snapshot, Vector *segments, int32_t seg_tick, LexiconReader *lex_reader); inert DefaultPostingListReader* init(DefaultPostingListReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick, + Snapshot *snapshot, Vector *segments, int32_t seg_tick, LexiconReader *lex_reader); public incremented nullable SegPostingList* http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PostingListWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PostingListWriter.c b/core/Lucy/Index/PostingListWriter.c index ff527bc..3c6e6aa 100644 --- a/core/Lucy/Index/PostingListWriter.c +++ b/core/Lucy/Index/PostingListWriter.c @@ -68,7 +68,7 @@ PListWriter_init(PostingListWriter *self, Schema *schema, Snapshot *snapshot, ivars->lex_writer = (LexiconWriter*)INCREF(lex_writer); // Init. - ivars->pools = VA_new(Schema_Num_Fields(schema)); + ivars->pools = Vec_new(Schema_Num_Fields(schema)); ivars->mem_thresh = default_mem_thresh; ivars->mem_pool = MemPool_new(0); ivars->lex_temp_out = NULL; @@ -104,14 +104,14 @@ S_lazy_init(PostingListWriter *self) { static PostingPool* S_lazy_init_posting_pool(PostingListWriter *self, int32_t field_num) { PostingListWriterIVARS *const ivars = PListWriter_IVARS(self); - PostingPool *pool = (PostingPool*)VA_Fetch(ivars->pools, field_num); + PostingPool *pool = (PostingPool*)Vec_Fetch(ivars->pools, field_num); if (!pool && field_num != 0) { String *field = Seg_Field_Name(ivars->segment, field_num); pool = PostPool_new(ivars->schema, ivars->snapshot, ivars->segment, ivars->polyreader, field, ivars->lex_writer, ivars->mem_pool, ivars->lex_temp_out, ivars->post_temp_out, ivars->skip_out); - VA_Store(ivars->pools, field_num, (Obj*)pool); + Vec_Store(ivars->pools, field_num, (Obj*)pool); } return pool; } @@ -167,8 +167,8 @@ PListWriter_Add_Inverted_Doc_IMP(PostingListWriter *self, Inverter *inverter, // flush all of them, then release all the RawPostings with a single // action. if (MemPool_Get_Consumed(ivars->mem_pool) > ivars->mem_thresh) { - for (uint32_t i = 0, max = VA_Get_Size(ivars->pools); i < max; i++) { - PostingPool *const pool = (PostingPool*)VA_Fetch(ivars->pools, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->pools); i < max; i++) { + PostingPool *const pool = (PostingPool*)Vec_Fetch(ivars->pools, i); if (pool) { PostPool_Flush(pool); } } MemPool_Release_All(ivars->mem_pool); @@ -182,11 +182,11 @@ PListWriter_Add_Segment_IMP(PostingListWriter *self, SegReader *reader, Segment *other_segment = SegReader_Get_Segment(reader); Schema *schema = ivars->schema; Segment *segment = ivars->segment; - VArray *all_fields = Schema_All_Fields(schema); + Vector *all_fields = Schema_All_Fields(schema); S_lazy_init(self); - for (uint32_t i = 0, max = VA_Get_Size(all_fields); i < max; i++) { - String *field = (String*)VA_Fetch(all_fields, i); + for (uint32_t i = 0, max = Vec_Get_Size(all_fields); i < max; i++) { + String *field = (String*)Vec_Fetch(all_fields, i); FieldType *type = Schema_Fetch_Type(schema, field); int32_t old_field_num = Seg_Field_Num(other_segment, field); int32_t new_field_num = Seg_Field_Num(segment, field); @@ -223,14 +223,14 @@ PListWriter_Finish_IMP(PostingListWriter *self) { OutStream_Close(ivars->post_temp_out); // Try to free up some memory. - for (uint32_t i = 0, max = VA_Get_Size(ivars->pools); i < max; i++) { - PostingPool *pool = (PostingPool*)VA_Fetch(ivars->pools, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->pools); i < max; i++) { + PostingPool *pool = (PostingPool*)Vec_Fetch(ivars->pools, i); if (pool) { PostPool_Shrink(pool); } } // Write postings for each field. - for (uint32_t i = 0, max = VA_Get_Size(ivars->pools); i < max; i++) { - PostingPool *pool = (PostingPool*)VA_Delete(ivars->pools, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->pools); i < max; i++) { + PostingPool *pool = (PostingPool*)Vec_Delete(ivars->pools, i); if (pool) { // Write out content for each PostingPool. Let each PostingPool // use more RAM while finishing. (This is a little dicy, because if http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PostingListWriter.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PostingListWriter.cfh b/core/Lucy/Index/PostingListWriter.cfh index f70e5ca..76339e0 100644 --- a/core/Lucy/Index/PostingListWriter.cfh +++ b/core/Lucy/Index/PostingListWriter.cfh @@ -26,7 +26,7 @@ class Lucy::Index::PostingListWriter nickname PListWriter inherits Lucy::Index::DataWriter { LexiconWriter *lex_writer; - VArray *pools; + Vector *pools; MemoryPool *mem_pool; OutStream *lex_temp_out; OutStream *post_temp_out; http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/PostingPool.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c index 0deef4a..5f6341d 100644 --- a/core/Lucy/Index/PostingPool.c +++ b/core/Lucy/Index/PostingPool.c @@ -174,7 +174,7 @@ PostPool_Get_Mem_Pool_IMP(PostingPool *self) { void PostPool_Flip_IMP(PostingPool *self) { PostingPoolIVARS *const ivars = PostPool_IVARS(self); - uint32_t num_runs = VA_Get_Size(ivars->runs); + uint32_t num_runs = Vec_Get_Size(ivars->runs); uint32_t sub_thresh = num_runs > 0 ? ivars->mem_thresh / num_runs : ivars->mem_thresh; @@ -218,7 +218,7 @@ PostPool_Flip_IMP(PostingPool *self) { // Assign. for (uint32_t i = 0; i < num_runs; i++) { - PostingPool *run = (PostingPool*)VA_Fetch(ivars->runs, i); + PostingPool *run = (PostingPool*)Vec_Fetch(ivars->runs, i); if (run != NULL) { PostPool_Set_Mem_Thresh(run, sub_thresh); if (!PostPool_IVARS(run)->lexicon) { http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SegReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SegReader.c b/core/Lucy/Index/SegReader.c index 823aa27..33253e2 100644 --- a/core/Lucy/Index/SegReader.c +++ b/core/Lucy/Index/SegReader.c @@ -35,14 +35,14 @@ S_try_init_components(void *context); SegReader* SegReader_new(Schema *schema, Folder *folder, Snapshot *snapshot, - VArray *segments, int32_t seg_tick) { + Vector *segments, int32_t seg_tick) { SegReader *self = (SegReader*)Class_Make_Obj(SEGREADER); return SegReader_init(self, schema, folder, snapshot, segments, seg_tick); } SegReader* SegReader_init(SegReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick) { + Snapshot *snapshot, Vector *segments, int32_t seg_tick) { Segment *segment; IxReader_init((IndexReader*)self, schema, folder, snapshot, segments, @@ -127,10 +127,10 @@ SegReader_Offsets_IMP(SegReader *self) { return I32Arr_new_steal(ints, 1); } -VArray* +Vector* SegReader_Seg_Readers_IMP(SegReader *self) { - VArray *seg_readers = VA_new(1); - VA_Push(seg_readers, INCREF(self)); + Vector *seg_readers = Vec_new(1); + Vec_Push(seg_readers, INCREF(self)); return seg_readers; } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SegReader.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SegReader.cfh b/core/Lucy/Index/SegReader.cfh index 5ae6af7..81b7333 100644 --- a/core/Lucy/Index/SegReader.cfh +++ b/core/Lucy/Index/SegReader.cfh @@ -37,7 +37,7 @@ public class Lucy::Index::SegReader inherits Lucy::Index::IndexReader { inert incremented SegReader* new(Schema *schema, Folder *folder, Snapshot *snapshot = NULL, - VArray *segments, int32_t seg_tick); + Vector *segments, int32_t seg_tick); /** * @param schema A Schema. @@ -50,7 +50,7 @@ public class Lucy::Index::SegReader inherits Lucy::Index::IndexReader { */ inert SegReader* init(SegReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot = NULL, VArray *segments, int32_t seg_tick); + Snapshot *snapshot = NULL, Vector *segments, int32_t seg_tick); public void Destroy(SegReader *self); @@ -88,7 +88,7 @@ public class Lucy::Index::SegReader inherits Lucy::Index::IndexReader { public incremented I32Array* Offsets(SegReader *self); - public incremented VArray* + public incremented Vector* Seg_Readers(SegReader *self); } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SegWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SegWriter.c b/core/Lucy/Index/SegWriter.c index c557e3d..fa6a552 100644 --- a/core/Lucy/Index/SegWriter.c +++ b/core/Lucy/Index/SegWriter.c @@ -45,7 +45,7 @@ SegWriter_init(SegWriter *self, Schema *schema, Snapshot *snapshot, SegWriterIVARS *const ivars = SegWriter_IVARS(self); ivars->by_api = Hash_new(0); ivars->inverter = Inverter_new(schema, segment); - ivars->writers = VA_new(16); + ivars->writers = Vec_new(16); Arch_Init_Seg_Writer(arch, self); return self; } @@ -80,7 +80,7 @@ SegWriter_Fetch_IMP(SegWriter *self, String *api) { void SegWriter_Add_Writer_IMP(SegWriter *self, DataWriter *writer) { SegWriterIVARS *const ivars = SegWriter_IVARS(self); - VA_Push(ivars->writers, (Obj*)writer); + Vec_Push(ivars->writers, (Obj*)writer); } void @@ -115,8 +115,8 @@ void SegWriter_Add_Inverted_Doc_IMP(SegWriter *self, Inverter *inverter, int32_t doc_id) { SegWriterIVARS *const ivars = SegWriter_IVARS(self); - for (uint32_t i = 0, max = VA_Get_Size(ivars->writers); i < max; i++) { - DataWriter *writer = (DataWriter*)VA_Fetch(ivars->writers, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->writers); i < max; i++) { + DataWriter *writer = (DataWriter*)Vec_Fetch(ivars->writers, i); DataWriter_Add_Inverted_Doc(writer, inverter, doc_id); } } @@ -140,8 +140,8 @@ SegWriter_Add_Segment_IMP(SegWriter *self, SegReader *reader, SegWriterIVARS *const ivars = SegWriter_IVARS(self); // Bulk add the slab of documents to the various writers. - for (uint32_t i = 0, max = VA_Get_Size(ivars->writers); i < max; i++) { - DataWriter *writer = (DataWriter*)VA_Fetch(ivars->writers, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->writers); i < max; i++) { + DataWriter *writer = (DataWriter*)Vec_Fetch(ivars->writers, i); DataWriter_Add_Segment(writer, reader, doc_map); } @@ -161,8 +161,8 @@ SegWriter_Merge_Segment_IMP(SegWriter *self, SegReader *reader, String *seg_name = Seg_Get_Name(SegReader_Get_Segment(reader)); // Have all the sub-writers merge the segment. - for (uint32_t i = 0, max = VA_Get_Size(ivars->writers); i < max; i++) { - DataWriter *writer = (DataWriter*)VA_Fetch(ivars->writers, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->writers); i < max; i++) { + DataWriter *writer = (DataWriter*)Vec_Fetch(ivars->writers, i); DataWriter_Merge_Segment(writer, reader, doc_map); } DelWriter_Merge_Segment(ivars->del_writer, reader, doc_map); @@ -181,8 +181,8 @@ SegWriter_Delete_Segment_IMP(SegWriter *self, SegReader *reader) { String *seg_name = Seg_Get_Name(SegReader_Get_Segment(reader)); // Have all the sub-writers delete the segment. - for (uint32_t i = 0, max = VA_Get_Size(ivars->writers); i < max; i++) { - DataWriter *writer = (DataWriter*)VA_Fetch(ivars->writers, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->writers); i < max; i++) { + DataWriter *writer = (DataWriter*)Vec_Fetch(ivars->writers, i); DataWriter_Delete_Segment(writer, reader); } DelWriter_Delete_Segment(ivars->del_writer, reader); @@ -197,8 +197,8 @@ SegWriter_Finish_IMP(SegWriter *self) { String *seg_name = Seg_Get_Name(ivars->segment); // Finish off children. - for (uint32_t i = 0, max = VA_Get_Size(ivars->writers); i < max; i++) { - DataWriter *writer = (DataWriter*)VA_Fetch(ivars->writers, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->writers); i < max; i++) { + DataWriter *writer = (DataWriter*)Vec_Fetch(ivars->writers, i); DataWriter_Finish(writer); } @@ -216,7 +216,7 @@ SegWriter_Finish_IMP(SegWriter *self) { void SegWriter_Add_Data_Writer_IMP(SegWriter *self, DataWriter *writer) { SegWriterIVARS *const ivars = SegWriter_IVARS(self); - VA_Push(ivars->writers, (Obj*)writer); + Vec_Push(ivars->writers, (Obj*)writer); } void http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SegWriter.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SegWriter.cfh b/core/Lucy/Index/SegWriter.cfh index 17b2d7d..0d6629d 100644 --- a/core/Lucy/Index/SegWriter.cfh +++ b/core/Lucy/Index/SegWriter.cfh @@ -34,7 +34,7 @@ parcel Lucy; public class Lucy::Index::SegWriter inherits Lucy::Index::DataWriter { Inverter *inverter; - VArray *writers; + Vector *writers; Hash *by_api; DeletionsWriter *del_writer; http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/Segment.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c index 4d6f203..17a3a5f 100644 --- a/core/Lucy/Index/Segment.c +++ b/core/Lucy/Index/Segment.c @@ -41,11 +41,11 @@ Seg_init(Segment *self, int64_t number) { // Init. ivars->metadata = Hash_new(0); ivars->count = 0; - ivars->by_num = VA_new(2); + ivars->by_num = Vec_new(2); ivars->by_name = Hash_new(0); // Start field numbers at 1, not 0. - VA_Push(ivars->by_num, (Obj*)Str_newf("")); + Vec_Push(ivars->by_num, (Obj*)Str_newf("")); // Assign. ivars->number = number; @@ -116,9 +116,9 @@ Seg_Read_File_IMP(Segment *self, Folder *folder) { else { ivars->count = Obj_To_I64(count); } // Get list of field nums. - VArray *source_by_num = (VArray*)Hash_Fetch_Utf8(my_metadata, + Vector *source_by_num = (Vector*)Hash_Fetch_Utf8(my_metadata, "field_names", 11); - uint32_t num_fields = source_by_num ? VA_Get_Size(source_by_num) : 0; + uint32_t num_fields = source_by_num ? Vec_Get_Size(source_by_num) : 0; if (source_by_num == NULL) { THROW(ERR, "Failed to extract 'field_names' from metadata"); } @@ -126,12 +126,12 @@ Seg_Read_File_IMP(Segment *self, Folder *folder) { // Init. DECREF(ivars->by_num); DECREF(ivars->by_name); - ivars->by_num = VA_new(num_fields); + ivars->by_num = Vec_new(num_fields); ivars->by_name = Hash_new(num_fields); // Copy the list of fields from the source. for (uint32_t i = 0; i < num_fields; i++) { - String *name = (String*)VA_Fetch(source_by_num, i); + String *name = (String*)Vec_Fetch(source_by_num, i); Seg_Add_Field(self, name); } @@ -165,9 +165,9 @@ Seg_Add_Field_IMP(Segment *self, String *field) { return Int32_Get_Value(num); } else { - int32_t field_num = VA_Get_Size(ivars->by_num); + int32_t field_num = Vec_Get_Size(ivars->by_num); Hash_Store(ivars->by_name, field, (Obj*)Int32_new(field_num)); - VA_Push(ivars->by_num, (Obj*)Str_Clone(field)); + Vec_Push(ivars->by_num, (Obj*)Str_Clone(field)); return field_num; } } @@ -246,7 +246,7 @@ String* Seg_Field_Name_IMP(Segment *self, int32_t field_num) { SegmentIVARS *const ivars = Seg_IVARS(self); return field_num - ? (String*)VA_Fetch(ivars->by_num, field_num) + ? (String*)Vec_Fetch(ivars->by_num, field_num) : NULL; } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/Segment.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Segment.cfh b/core/Lucy/Index/Segment.cfh index fc6d8bb..f51a0af 100644 --- a/core/Lucy/Index/Segment.cfh +++ b/core/Lucy/Index/Segment.cfh @@ -37,7 +37,7 @@ public class Lucy::Index::Segment nickname Seg inherits Clownfish::Obj { int64_t count; int64_t number; Hash *by_name; /* field numbers by name */ - VArray *by_num; /* field names by num */ + Vector *by_num; /* field names by num */ Hash *metadata; inert incremented Segment* http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/Snapshot.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Snapshot.c b/core/Lucy/Index/Snapshot.c index b2ba7e1..9d710df 100644 --- a/core/Lucy/Index/Snapshot.c +++ b/core/Lucy/Index/Snapshot.c @@ -24,8 +24,8 @@ #include "Lucy/Util/IndexFileNames.h" #include "Lucy/Util/Json.h" -static VArray* -S_clean_segment_contents(VArray *orig); +static Vector* +S_clean_segment_contents(Vector *orig); int32_t Snapshot_current_file_format = 2; static int32_t Snapshot_current_file_subformat = 1; @@ -78,7 +78,7 @@ Snapshot_Delete_Entry_IMP(Snapshot *self, String *entry) { } } -VArray* +Vector* Snapshot_List_IMP(Snapshot *self) { SnapshotIVARS *const ivars = Snapshot_IVARS(self); return Hash_Keys(ivars->entries); @@ -128,18 +128,18 @@ Snapshot_Read_File_IMP(Snapshot *self, Folder *folder, String *path) { } // Build up list of entries. - VArray *list = (VArray*)INCREF(CERTIFY( + Vector *list = (Vector*)INCREF(CERTIFY( Hash_Fetch_Utf8(snap_data, "entries", 7), - VARRAY)); + VECTOR)); if (format == 1 || (format == 2 && subformat < 1)) { - VArray *cleaned = S_clean_segment_contents(list); + Vector *cleaned = S_clean_segment_contents(list); DECREF(list); list = cleaned; } Hash_Clear(ivars->entries); - for (uint32_t i = 0, max = VA_Get_Size(list); i < max; i++) { + for (uint32_t i = 0, max = Vec_Get_Size(list); i < max; i++) { String *entry - = (String*)CERTIFY(VA_Fetch(list, i), STRING); + = (String*)CERTIFY(Vec_Fetch(list, i), STRING); Hash_Store(ivars->entries, entry, (Obj*)CFISH_TRUE); } @@ -150,20 +150,20 @@ Snapshot_Read_File_IMP(Snapshot *self, Folder *folder, String *path) { return self; } -static VArray* -S_clean_segment_contents(VArray *orig) { +static Vector* +S_clean_segment_contents(Vector *orig) { // Since Snapshot format 2, no DataReader has depended on individual files // within segment directories being listed. Filter these files because // they cause a problem with FilePurger. - VArray *cleaned = VA_new(VA_Get_Size(orig)); - for (uint32_t i = 0, max = VA_Get_Size(orig); i < max; i++) { - String *name = (String*)VA_Fetch(orig, i); + Vector *cleaned = Vec_new(Vec_Get_Size(orig)); + for (uint32_t i = 0, max = Vec_Get_Size(orig); i < max; i++) { + String *name = (String*)Vec_Fetch(orig, i); if (!Seg_valid_seg_name(name)) { if (Str_Starts_With_Utf8(name, "seg_", 4)) { continue; // Skip this file. } } - VA_Push(cleaned, INCREF(name)); + Vec_Push(cleaned, INCREF(name)); } return cleaned; } @@ -173,7 +173,7 @@ void Snapshot_Write_File_IMP(Snapshot *self, Folder *folder, String *path) { SnapshotIVARS *const ivars = Snapshot_IVARS(self); Hash *all_data = Hash_new(0); - VArray *list = Snapshot_List(self); + Vector *list = Snapshot_List(self); // Update path. DECREF(ivars->path); @@ -195,7 +195,7 @@ Snapshot_Write_File_IMP(Snapshot *self, Folder *folder, String *path) { } // Sort, then store file names. - VA_Sort(list); + Vec_Sort(list); Hash_Store_Utf8(all_data, "entries", 7, (Obj*)list); // Create a JSON-izable data structure. http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/Snapshot.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Snapshot.cfh b/core/Lucy/Index/Snapshot.cfh index 89b0de9..17de30f 100644 --- a/core/Lucy/Index/Snapshot.cfh +++ b/core/Lucy/Index/Snapshot.cfh @@ -44,7 +44,7 @@ public class Lucy::Index::Snapshot inherits Clownfish::Obj { /** Return an array of all entries. */ - public incremented VArray* + public incremented Vector* List(Snapshot *self); /** Return the number of entries (including directories). http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SortFieldWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c index 9ef8bf4..ff41e73 100644 --- a/core/Lucy/Index/SortFieldWriter.c +++ b/core/Lucy/Index/SortFieldWriter.c @@ -481,7 +481,7 @@ void SortFieldWriter_Flip_IMP(SortFieldWriter *self) { SortFieldWriterIVARS *const ivars = SortFieldWriter_IVARS(self); uint32_t num_items = SortFieldWriter_Buffer_Count(self); - uint32_t num_runs = VA_Get_Size(ivars->runs); + uint32_t num_runs = Vec_Get_Size(ivars->runs); if (ivars->flipped) { THROW(ERR, "Can't call Flip() twice"); } ivars->flipped = true; @@ -517,7 +517,7 @@ SortFieldWriter_Flip_IMP(SortFieldWriter *self) { size_t sub_thresh = ivars->mem_thresh / num_runs; if (sub_thresh < 65536) { sub_thresh = 65536; } for (uint32_t i = 0; i < num_runs; i++) { - SortFieldWriter *run = (SortFieldWriter*)VA_Fetch(ivars->runs, i); + SortFieldWriter *run = (SortFieldWriter*)Vec_Fetch(ivars->runs, i); S_flip_run(run, sub_thresh, ivars->ord_in, ivars->ix_in, ivars->dat_in); } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SortReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortReader.c b/core/Lucy/Index/SortReader.c index c438e6c..b8359bf 100644 --- a/core/Lucy/Index/SortReader.c +++ b/core/Lucy/Index/SortReader.c @@ -31,7 +31,7 @@ SortReader* SortReader_init(SortReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick) { + Snapshot *snapshot, Vector *segments, int32_t seg_tick) { DataReader_init((DataReader*)self, schema, folder, snapshot, segments, seg_tick); ABSTRACT_CLASS_CHECK(self, SORTREADER); @@ -39,7 +39,7 @@ SortReader_init(SortReader *self, Schema *schema, Folder *folder, } DataReader* -SortReader_Aggregator_IMP(SortReader *self, VArray *readers, +SortReader_Aggregator_IMP(SortReader *self, Vector *readers, I32Array *offsets) { UNUSED_VAR(self); UNUSED_VAR(readers); @@ -49,7 +49,7 @@ SortReader_Aggregator_IMP(SortReader *self, VArray *readers, DefaultSortReader* DefSortReader_new(Schema *schema, Folder *folder, Snapshot *snapshot, - VArray *segments, int32_t seg_tick) { + Vector *segments, int32_t seg_tick) { DefaultSortReader *self = (DefaultSortReader*)Class_Make_Obj(DEFAULTSORTREADER); return DefSortReader_init(self, schema, folder, snapshot, segments, @@ -58,7 +58,7 @@ DefSortReader_new(Schema *schema, Folder *folder, Snapshot *snapshot, DefaultSortReader* DefSortReader_init(DefaultSortReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick) { + Snapshot *snapshot, Vector *segments, int32_t seg_tick) { DataReader_init((DataReader*)self, schema, folder, snapshot, segments, seg_tick); DefaultSortReaderIVARS *const ivars = DefSortReader_IVARS(self); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SortReader.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortReader.cfh b/core/Lucy/Index/SortReader.cfh index 34e5f99..a36db95 100644 --- a/core/Lucy/Index/SortReader.cfh +++ b/core/Lucy/Index/SortReader.cfh @@ -23,7 +23,7 @@ abstract class Lucy::Index::SortReader inert SortReader* init(SortReader *self, Schema *schema = NULL, Folder *folder = NULL, - Snapshot *snapshot = NULL, VArray *segments = NULL, + Snapshot *snapshot = NULL, Vector *segments = NULL, int32_t seg_tick = -1); abstract nullable SortCache* @@ -33,7 +33,7 @@ abstract class Lucy::Index::SortReader * the default implementation. */ public incremented nullable DataReader* - Aggregator(SortReader *self, VArray *readers, I32Array *offsets); + Aggregator(SortReader *self, Vector *readers, I32Array *offsets); } @@ -47,12 +47,12 @@ class Lucy::Index::DefaultSortReader nickname DefSortReader int32_t format; inert incremented DefaultSortReader* - new(Schema *schema, Folder *folder, Snapshot *snapshot, VArray *segments, + new(Schema *schema, Folder *folder, Snapshot *snapshot, Vector *segments, int32_t seg_tick); inert DefaultSortReader* init(DefaultSortReader *self, Schema *schema, Folder *folder, - Snapshot *snapshot, VArray *segments, int32_t seg_tick); + Snapshot *snapshot, Vector *segments, int32_t seg_tick); nullable SortCache* Fetch_Sort_Cache(DefaultSortReader *self, String *field); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SortWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortWriter.c b/core/Lucy/Index/SortWriter.c index f2d18de..4c9ce50 100644 --- a/core/Lucy/Index/SortWriter.c +++ b/core/Lucy/Index/SortWriter.c @@ -55,7 +55,7 @@ SortWriter_init(SortWriter *self, Schema *schema, Snapshot *snapshot, SortWriterIVARS *const ivars = SortWriter_IVARS(self); // Init. - ivars->field_writers = VA_new(field_max); + ivars->field_writers = Vec_new(field_max); ivars->counts = Hash_new(0); ivars->null_ords = Hash_new(0); ivars->ord_widths = Hash_new(0); @@ -93,7 +93,7 @@ S_lazy_init_field_writer(SortWriter *self, int32_t field_num) { SortWriterIVARS *const ivars = SortWriter_IVARS(self); SortFieldWriter *field_writer - = (SortFieldWriter*)VA_Fetch(ivars->field_writers, field_num); + = (SortFieldWriter*)Vec_Fetch(ivars->field_writers, field_num); if (!field_writer) { // Open temp files. @@ -126,7 +126,7 @@ S_lazy_init_field_writer(SortWriter *self, int32_t field_num) { ivars->polyreader, field, ivars->counter, ivars->mem_thresh, ivars->temp_ord_out, ivars->temp_ix_out, ivars->temp_dat_out); - VA_Store(ivars->field_writers, field_num, (Obj*)field_writer); + Vec_Store(ivars->field_writers, field_num, (Obj*)field_writer); } return field_writer; } @@ -152,9 +152,9 @@ SortWriter_Add_Inverted_Doc_IMP(SortWriter *self, Inverter *inverter, // flush all of them, then reset the counter which tracks memory // consumption. if (Counter_Get_Value(ivars->counter) > ivars->mem_thresh) { - for (uint32_t i = 0; i < VA_Get_Size(ivars->field_writers); i++) { + for (uint32_t i = 0; i < Vec_Get_Size(ivars->field_writers); i++) { SortFieldWriter *const field_writer - = (SortFieldWriter*)VA_Fetch(ivars->field_writers, i); + = (SortFieldWriter*)Vec_Fetch(ivars->field_writers, i); if (field_writer) { SortFieldWriter_Flush(field_writer); } } Counter_Reset(ivars->counter); @@ -166,11 +166,11 @@ void SortWriter_Add_Segment_IMP(SortWriter *self, SegReader *reader, I32Array *doc_map) { SortWriterIVARS *const ivars = SortWriter_IVARS(self); - VArray *fields = Schema_All_Fields(ivars->schema); + Vector *fields = Schema_All_Fields(ivars->schema); // Proceed field-at-a-time, rather than doc-at-a-time. - for (uint32_t i = 0, max = VA_Get_Size(fields); i < max; i++) { - String *field = (String*)VA_Fetch(fields, i); + for (uint32_t i = 0, max = Vec_Get_Size(fields); i < max; i++) { + String *field = (String*)Vec_Fetch(fields, i); SortReader *sort_reader = (SortReader*)SegReader_Fetch( reader, Class_Get_Name(SORTREADER)); SortCache *cache = sort_reader @@ -191,7 +191,7 @@ SortWriter_Add_Segment_IMP(SortWriter *self, SegReader *reader, void SortWriter_Finish_IMP(SortWriter *self) { SortWriterIVARS *const ivars = SortWriter_IVARS(self); - VArray *const field_writers = ivars->field_writers; + Vector *const field_writers = ivars->field_writers; // If we have no data, bail out. if (!ivars->temp_ord_out) { return; } @@ -199,9 +199,9 @@ SortWriter_Finish_IMP(SortWriter *self) { // If we've either flushed or added segments, flush everything so that any // one field can use the entire margin up to mem_thresh. if (ivars->flush_at_finish) { - for (uint32_t i = 1, max = VA_Get_Size(field_writers); i < max; i++) { + for (uint32_t i = 1, max = Vec_Get_Size(field_writers); i < max; i++) { SortFieldWriter *field_writer - = (SortFieldWriter*)VA_Fetch(field_writers, i); + = (SortFieldWriter*)Vec_Fetch(field_writers, i); if (field_writer) { SortFieldWriter_Flush(field_writer); } @@ -213,9 +213,9 @@ SortWriter_Finish_IMP(SortWriter *self) { OutStream_Close(ivars->temp_ix_out); OutStream_Close(ivars->temp_dat_out); - for (uint32_t i = 1, max = VA_Get_Size(field_writers); i < max; i++) { + for (uint32_t i = 1, max = Vec_Get_Size(field_writers); i < max; i++) { SortFieldWriter *field_writer - = (SortFieldWriter*)VA_Delete(field_writers, i); + = (SortFieldWriter*)Vec_Delete(field_writers, i); if (field_writer) { String *field = Seg_Field_Name(ivars->segment, i); SortFieldWriter_Flip(field_writer); @@ -233,7 +233,7 @@ SortWriter_Finish_IMP(SortWriter *self) { DECREF(field_writer); } - VA_Clear(field_writers); + Vec_Clear(field_writers); // Store metadata. Seg_Store_Metadata_Utf8(ivars->segment, "sort", 4, http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Index/SortWriter.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortWriter.cfh b/core/Lucy/Index/SortWriter.cfh index 6f4a242..6067233 100644 --- a/core/Lucy/Index/SortWriter.cfh +++ b/core/Lucy/Index/SortWriter.cfh @@ -28,7 +28,7 @@ parcel Lucy; class Lucy::Index::SortWriter inherits Lucy::Index::DataWriter { - VArray *field_writers; + Vector *field_writers; Hash *counts; Hash *null_ords; Hash *ord_widths; http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Plan/Architecture.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Plan/Architecture.c b/core/Lucy/Plan/Architecture.c index 8986f0e..36bebb0 100644 --- a/core/Lucy/Plan/Architecture.c +++ b/core/Lucy/Plan/Architecture.c @@ -173,7 +173,7 @@ void Arch_Register_Doc_Reader_IMP(Architecture *self, SegReader *reader) { Schema *schema = SegReader_Get_Schema(reader); Folder *folder = SegReader_Get_Folder(reader); - VArray *segments = SegReader_Get_Segments(reader); + Vector *segments = SegReader_Get_Segments(reader); Snapshot *snapshot = SegReader_Get_Snapshot(reader); int32_t seg_tick = SegReader_Get_Seg_Tick(reader); DefaultDocReader *doc_reader @@ -187,7 +187,7 @@ void Arch_Register_Posting_List_Reader_IMP(Architecture *self, SegReader *reader) { Schema *schema = SegReader_Get_Schema(reader); Folder *folder = SegReader_Get_Folder(reader); - VArray *segments = SegReader_Get_Segments(reader); + Vector *segments = SegReader_Get_Segments(reader); Snapshot *snapshot = SegReader_Get_Snapshot(reader); int32_t seg_tick = SegReader_Get_Seg_Tick(reader); LexiconReader *lex_reader = (LexiconReader*)SegReader_Obtain( @@ -204,7 +204,7 @@ void Arch_Register_Lexicon_Reader_IMP(Architecture *self, SegReader *reader) { Schema *schema = SegReader_Get_Schema(reader); Folder *folder = SegReader_Get_Folder(reader); - VArray *segments = SegReader_Get_Segments(reader); + Vector *segments = SegReader_Get_Segments(reader); Snapshot *snapshot = SegReader_Get_Snapshot(reader); int32_t seg_tick = SegReader_Get_Seg_Tick(reader); DefaultLexiconReader *lex_reader @@ -218,7 +218,7 @@ void Arch_Register_Sort_Reader_IMP(Architecture *self, SegReader *reader) { Schema *schema = SegReader_Get_Schema(reader); Folder *folder = SegReader_Get_Folder(reader); - VArray *segments = SegReader_Get_Segments(reader); + Vector *segments = SegReader_Get_Segments(reader); Snapshot *snapshot = SegReader_Get_Snapshot(reader); int32_t seg_tick = SegReader_Get_Seg_Tick(reader); DefaultSortReader *sort_reader @@ -232,7 +232,7 @@ void Arch_Register_Highlight_Reader_IMP(Architecture *self, SegReader *reader) { Schema *schema = SegReader_Get_Schema(reader); Folder *folder = SegReader_Get_Folder(reader); - VArray *segments = SegReader_Get_Segments(reader); + Vector *segments = SegReader_Get_Segments(reader); Snapshot *snapshot = SegReader_Get_Snapshot(reader); int32_t seg_tick = SegReader_Get_Seg_Tick(reader); DefaultHighlightReader* hl_reader @@ -246,7 +246,7 @@ void Arch_Register_Deletions_Reader_IMP(Architecture *self, SegReader *reader) { Schema *schema = SegReader_Get_Schema(reader); Folder *folder = SegReader_Get_Folder(reader); - VArray *segments = SegReader_Get_Segments(reader); + Vector *segments = SegReader_Get_Segments(reader); Snapshot *snapshot = SegReader_Get_Snapshot(reader); int32_t seg_tick = SegReader_Get_Seg_Tick(reader); DefaultDeletionsReader* del_reader http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Plan/Schema.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c index 83feaa0..5c40b04 100644 --- a/core/Lucy/Plan/Schema.c +++ b/core/Lucy/Plan/Schema.c @@ -36,7 +36,7 @@ // Scan the array to see if an object testing as Equal is present. If not, // push the elem onto the end of the array. static void -S_add_unique(VArray *array, Obj *elem); +S_add_unique(Vector *array, Obj *elem); static void S_add_text_field(Schema *self, String *field, FieldType *type); @@ -60,8 +60,8 @@ Schema_init(Schema *self) { ivars->analyzers = Hash_new(0); ivars->types = Hash_new(0); ivars->sims = Hash_new(0); - ivars->uniq_analyzers = VA_new(2); - VA_Resize(ivars->uniq_analyzers, 1); + ivars->uniq_analyzers = Vec_new(2); + Vec_Resize(ivars->uniq_analyzers, 1); // Assign. ivars->arch = Schema_Architecture(self); @@ -83,17 +83,17 @@ Schema_Destroy_IMP(Schema *self) { } static void -S_add_unique(VArray *array, Obj *elem) { +S_add_unique(Vector *array, Obj *elem) { if (!elem) { return; } - for (uint32_t i = 0, max = VA_Get_Size(array); i < max; i++) { - Obj *candidate = VA_Fetch(array, i); + for (uint32_t i = 0, max = Vec_Get_Size(array); i < max; i++) { + Obj *candidate = Vec_Fetch(array, i); if (!candidate) { continue; } if (elem == candidate) { return; } if (Obj_Get_Class(elem) == Obj_Get_Class(candidate)) { if (Obj_Equals(elem, candidate)) { return; } } } - VA_Push(array, INCREF(elem)); + Vec_Push(array, INCREF(elem)); } bool @@ -224,15 +224,15 @@ Schema_Get_Similarity_IMP(Schema *self) { return Schema_IVARS(self)->sim; } -VArray* +Vector* Schema_All_Fields_IMP(Schema *self) { return Hash_Keys(Schema_IVARS(self)->types); } uint32_t -S_find_in_array(VArray *array, Obj *obj) { - for (uint32_t i = 0, max = VA_Get_Size(array); i < max; i++) { - Obj *candidate = VA_Fetch(array, i); +S_find_in_array(Vector *array, Obj *obj) { + for (uint32_t i = 0, max = Vec_Get_Size(array); i < max; i++) { + Obj *candidate = Vec_Fetch(array, i); if (obj == NULL && candidate == NULL) { return i; } @@ -313,16 +313,16 @@ Schema_Load_IMP(Schema *self, Obj *dump) { Schema *loaded = (Schema*)Class_Make_Obj(klass); Hash *type_dumps = (Hash*)CERTIFY(Hash_Fetch_Utf8(source, "fields", 6), HASH); - VArray *analyzer_dumps - = (VArray*)CERTIFY(Hash_Fetch_Utf8(source, "analyzers", 9), VARRAY); - VArray *analyzers - = (VArray*)Freezer_load((Obj*)analyzer_dumps); + Vector *analyzer_dumps + = (Vector*)CERTIFY(Hash_Fetch_Utf8(source, "analyzers", 9), VECTOR); + Vector *analyzers + = (Vector*)Freezer_load((Obj*)analyzer_dumps); UNUSED_VAR(self); // Start with a blank Schema. Schema_init(loaded); SchemaIVARS *const loaded_ivars = Schema_IVARS(loaded); - VA_Grow(loaded_ivars->uniq_analyzers, VA_Get_Size(analyzers)); + Vec_Grow(loaded_ivars->uniq_analyzers, Vec_Get_Size(analyzers)); HashIterator *iter = HashIter_new(type_dumps); while (HashIter_Next(iter)) { @@ -335,7 +335,7 @@ Schema_Load_IMP(Schema *self, Obj *dump) { Obj *tick = CERTIFY(Hash_Fetch_Utf8(type_dump, "analyzer", 8), OBJ); Analyzer *analyzer - = (Analyzer*)VA_Fetch(analyzers, + = (Analyzer*)Vec_Fetch(analyzers, (uint32_t)Obj_To_I64(tick)); if (!analyzer) { THROW(ERR, "Can't find analyzer for '%o'", field); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Plan/Schema.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Plan/Schema.cfh b/core/Lucy/Plan/Schema.cfh index d4f4632..84f48e6 100644 --- a/core/Lucy/Plan/Schema.cfh +++ b/core/Lucy/Plan/Schema.cfh @@ -32,7 +32,7 @@ public class Lucy::Plan::Schema inherits Clownfish::Obj { Hash *types; Hash *sims; Hash *analyzers; - VArray *uniq_analyzers; + Vector *uniq_analyzers; public inert incremented Schema* new(); @@ -84,7 +84,7 @@ public class Lucy::Plan::Schema inherits Clownfish::Obj { /** Return all the Schema's field names as an array. */ - public incremented VArray* + public incremented Vector* All_Fields(Schema *self); /** Return the Schema instance's internal Architecture object. http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/ANDMatcher.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/ANDMatcher.c b/core/Lucy/Search/ANDMatcher.c index 059e6f8..c16362c 100644 --- a/core/Lucy/Search/ANDMatcher.c +++ b/core/Lucy/Search/ANDMatcher.c @@ -21,13 +21,13 @@ #include "Lucy/Index/Similarity.h" ANDMatcher* -ANDMatcher_new(VArray *children, Similarity *sim) { +ANDMatcher_new(Vector *children, Similarity *sim) { ANDMatcher *self = (ANDMatcher*)Class_Make_Obj(ANDMATCHER); return ANDMatcher_init(self, children, sim); } ANDMatcher* -ANDMatcher_init(ANDMatcher *self, VArray *children, Similarity *sim) { +ANDMatcher_init(ANDMatcher *self, Vector *children, Similarity *sim) { ANDMatcherIVARS *const ivars = ANDMatcher_IVARS(self); // Init. @@ -38,7 +38,7 @@ ANDMatcher_init(ANDMatcher *self, VArray *children, Similarity *sim) { ivars->more = ivars->num_kids ? true : false; ivars->kids = (Matcher**)MALLOCATE(ivars->num_kids * sizeof(Matcher*)); for (uint32_t i = 0; i < ivars->num_kids; i++) { - Matcher *child = (Matcher*)VA_Fetch(children, i); + Matcher *child = (Matcher*)Vec_Fetch(children, i); ivars->kids[i] = child; if (!Matcher_Next(child)) { ivars->more = false; } } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/ANDMatcher.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/ANDMatcher.cfh b/core/Lucy/Search/ANDMatcher.cfh index 94202ec..3e624c7 100644 --- a/core/Lucy/Search/ANDMatcher.cfh +++ b/core/Lucy/Search/ANDMatcher.cfh @@ -26,10 +26,10 @@ class Lucy::Search::ANDMatcher inherits Lucy::Search::PolyMatcher { bool first_time; inert incremented ANDMatcher* - new(VArray *children, Similarity *sim); + new(Vector *children, Similarity *sim); inert ANDMatcher* - init(ANDMatcher *self, VArray *children, Similarity *similarity); + init(ANDMatcher *self, Vector *children, Similarity *similarity); public void Destroy(ANDMatcher *self); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/ANDQuery.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/ANDQuery.c b/core/Lucy/Search/ANDQuery.c index 5f96714..fa1067f 100644 --- a/core/Lucy/Search/ANDQuery.c +++ b/core/Lucy/Search/ANDQuery.c @@ -33,25 +33,25 @@ #include "Lucy/Util/Freezer.h" ANDQuery* -ANDQuery_new(VArray *children) { +ANDQuery_new(Vector *children) { ANDQuery *self = (ANDQuery*)Class_Make_Obj(ANDQUERY); return ANDQuery_init(self, children); } ANDQuery* -ANDQuery_init(ANDQuery *self, VArray *children) { +ANDQuery_init(ANDQuery *self, Vector *children) { return (ANDQuery*)PolyQuery_init((PolyQuery*)self, children); } String* ANDQuery_To_String_IMP(ANDQuery *self) { ANDQueryIVARS *const ivars = ANDQuery_IVARS(self); - uint32_t num_kids = VA_Get_Size(ivars->children); + uint32_t num_kids = Vec_Get_Size(ivars->children); if (!num_kids) { return Str_new_from_trusted_utf8("()", 2); } else { CharBuf *buf = CB_new_from_trusted_utf8("(", 1); for (uint32_t i = 0; i < num_kids; i++) { - String *kid_string = Obj_To_String(VA_Fetch(ivars->children, i)); + String *kid_string = Obj_To_String(Vec_Fetch(ivars->children, i)); CB_Cat(buf, kid_string); DECREF(kid_string); if (i == num_kids - 1) { @@ -107,18 +107,18 @@ Matcher* ANDCompiler_Make_Matcher_IMP(ANDCompiler *self, SegReader *reader, bool need_score) { ANDCompilerIVARS *const ivars = ANDCompiler_IVARS(self); - uint32_t num_kids = VA_Get_Size(ivars->children); + uint32_t num_kids = Vec_Get_Size(ivars->children); if (num_kids == 1) { - Compiler *only_child = (Compiler*)VA_Fetch(ivars->children, 0); + Compiler *only_child = (Compiler*)Vec_Fetch(ivars->children, 0); return Compiler_Make_Matcher(only_child, reader, need_score); } else { - VArray *child_matchers = VA_new(num_kids); + Vector *child_matchers = Vec_new(num_kids); // Add child matchers one by one. for (uint32_t i = 0; i < num_kids; i++) { - Compiler *child = (Compiler*)VA_Fetch(ivars->children, i); + Compiler *child = (Compiler*)Vec_Fetch(ivars->children, i); Matcher *child_matcher = Compiler_Make_Matcher(child, reader, need_score); @@ -128,7 +128,7 @@ ANDCompiler_Make_Matcher_IMP(ANDCompiler *self, SegReader *reader, return NULL; } else { - VA_Push(child_matchers, (Obj*)child_matcher); + Vec_Push(child_matchers, (Obj*)child_matcher); } } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/ANDQuery.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/ANDQuery.cfh b/core/Lucy/Search/ANDQuery.cfh index e838338..4f04028 100644 --- a/core/Lucy/Search/ANDQuery.cfh +++ b/core/Lucy/Search/ANDQuery.cfh @@ -25,13 +25,13 @@ parcel Lucy; public class Lucy::Search::ANDQuery inherits Lucy::Search::PolyQuery { inert incremented ANDQuery* - new(VArray *children = NULL); + new(Vector *children = NULL); /** * @param children An array of child Queries. */ public inert ANDQuery* - init(ANDQuery *self, VArray *children = NULL); + init(ANDQuery *self, Vector *children = NULL); public incremented Compiler* Make_Compiler(ANDQuery *self, Searcher *searcher, float boost,
