http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/Collector/SortCollector.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/Collector/SortCollector.c b/core/Lucy/Search/Collector/SortCollector.c index db5d742..5354642 100644 --- a/core/Lucy/Search/Collector/SortCollector.c +++ b/core/Lucy/Search/Collector/SortCollector.c @@ -74,21 +74,21 @@ SortColl_new(Schema *schema, SortSpec *sort_spec, uint32_t wanted) { } // Default to sort-by-score-then-doc-id. -static VArray* +static Vector* S_default_sort_rules() { - VArray *rules = VA_new(1); - VA_Push(rules, (Obj*)SortRule_new(SortRule_SCORE, NULL, false)); - VA_Push(rules, (Obj*)SortRule_new(SortRule_DOC_ID, NULL, false)); + Vector *rules = Vec_new(1); + Vec_Push(rules, (Obj*)SortRule_new(SortRule_SCORE, NULL, false)); + Vec_Push(rules, (Obj*)SortRule_new(SortRule_DOC_ID, NULL, false)); return rules; } SortCollector* SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec, uint32_t wanted) { - VArray *rules = sort_spec - ? (VArray*)INCREF(SortSpec_Get_Rules(sort_spec)) + Vector *rules = sort_spec + ? (Vector*)INCREF(SortSpec_Get_Rules(sort_spec)) : S_default_sort_rules(); - uint32_t num_rules = VA_Get_Size(rules); + uint32_t num_rules = Vec_Get_Size(rules); // Validate. if (sort_spec && !schema) { @@ -123,7 +123,7 @@ SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec, ivars->need_score = false; ivars->need_values = false; for (uint32_t i = 0; i < num_rules; i++) { - SortRule *rule = (SortRule*)VA_Fetch(rules, i); + SortRule *rule = (SortRule*)Vec_Fetch(rules, i); int32_t rule_type = SortRule_Get_Type(rule); ivars->actions[i] = S_derive_action(rule, NULL); if (rule_type == SortRule_SCORE) { @@ -156,7 +156,7 @@ SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec, // Prepare a MatchDoc-in-waiting. - VArray *values = ivars->need_values ? VA_new(num_rules) : NULL; + Vector *values = ivars->need_values ? Vec_new(num_rules) : NULL; float score = ivars->need_score ? CHY_F32_NEGINF : CHY_F32_NAN; ivars->bumped = MatchDoc_new(INT32_MAX, score, values); DECREF(values); @@ -240,7 +240,7 @@ SortColl_Set_Reader_IMP(SortCollector *self, SegReader *reader) { // 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*)VA_Fetch(ivars->rules, 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) @@ -258,7 +258,7 @@ SortColl_Set_Reader_IMP(SortCollector *self, SegReader *reader) { super_set_reader(self, reader); } -VArray* +Vector* SortColl_Pop_Match_Docs_IMP(SortCollector *self) { SortCollectorIVARS *const ivars = SortColl_IVARS(self); return HitQ_Pop_All(ivars->hit_q); @@ -293,16 +293,16 @@ SortColl_Collect_IMP(SortCollector *self, int32_t doc_id) { // Fetch values so that cross-segment sorting can work. if (ivars->need_values) { - VArray *values = match_doc_ivars->values; + Vector *values = match_doc_ivars->values; for (uint32_t i = 0, max = ivars->num_rules; i < max; i++) { SortCache *cache = ivars->sort_caches[i]; - Obj *old_val = VA_Delete(values, i); + Obj *old_val = Vec_Delete(values, i); DECREF(old_val); if (cache) { int32_t ord = SortCache_Ordinal(cache, doc_id); Obj *val = SortCache_Value(cache, ord); - if (val) { VA_Store(values, i, (Obj*)val); } + if (val) { Vec_Store(values, i, (Obj*)val); } } } } @@ -328,8 +328,8 @@ SortColl_Collect_IMP(SortCollector *self, int32_t doc_id) { } else { // The queue isn't full yet, so create a fresh MatchDoc. - VArray *values = ivars->need_values - ? VA_new(ivars->num_rules) + Vector *values = ivars->need_values + ? Vec_new(ivars->num_rules) : NULL; float fake_score = ivars->need_score ? CHY_F32_NEGINF
http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/Collector/SortCollector.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/Collector/SortCollector.cfh b/core/Lucy/Search/Collector/SortCollector.cfh index 331a548..e45d6f2 100644 --- a/core/Lucy/Search/Collector/SortCollector.cfh +++ b/core/Lucy/Search/Collector/SortCollector.cfh @@ -28,7 +28,7 @@ class Lucy::Search::Collector::SortCollector nickname SortColl uint32_t total_hits; HitQueue *hit_q; MatchDoc *bumped; - VArray *rules; + Vector *rules; SortCache **sort_caches; const void **ord_arrays; uint8_t *actions; @@ -62,7 +62,7 @@ class Lucy::Search::Collector::SortCollector nickname SortColl /** Empty out the HitQueue and return an array of sorted MatchDocs. */ - incremented VArray* + incremented Vector* Pop_Match_Docs(SortCollector *self); /** Accessor for "total_hits" member, which tracks the number of times http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/Compiler.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/Compiler.c b/core/Lucy/Search/Compiler.c index d8dd55e..346b8a9 100644 --- a/core/Lucy/Search/Compiler.c +++ b/core/Lucy/Search/Compiler.c @@ -95,14 +95,14 @@ Compiler_Normalize_IMP(Compiler *self) { Compiler_Apply_Norm_Factor(self, factor); } -VArray* +Vector* Compiler_Highlight_Spans_IMP(Compiler *self, Searcher *searcher, DocVector *doc_vec, String *field) { UNUSED_VAR(self); UNUSED_VAR(searcher); UNUSED_VAR(doc_vec); UNUSED_VAR(field); - return VA_new(0); + return Vec_new(0); } String* http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/Compiler.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/Compiler.cfh b/core/Lucy/Search/Compiler.cfh index d474674..34a52a1 100644 --- a/core/Lucy/Search/Compiler.cfh +++ b/core/Lucy/Search/Compiler.cfh @@ -147,7 +147,7 @@ public class Lucy::Search::Compiler inherits Lucy::Search::Query { * @param doc_vec A DocVector. * @param field The name of the field. */ - public incremented VArray* + public incremented Vector* Highlight_Spans(Compiler *self, Searcher *searcher, DocVector *doc_vec, String *field); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/HitQueue.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/HitQueue.c b/core/Lucy/Search/HitQueue.c index 6faa598..12324e7 100644 --- a/core/Lucy/Search/HitQueue.c +++ b/core/Lucy/Search/HitQueue.c @@ -47,8 +47,8 @@ HitQ_init(HitQueue *self, Schema *schema, SortSpec *sort_spec, uint32_t wanted) { HitQueueIVARS *const ivars = HitQ_IVARS(self); if (sort_spec) { - VArray *rules = SortSpec_Get_Rules(sort_spec); - uint32_t num_rules = VA_Get_Size(rules); + Vector *rules = SortSpec_Get_Rules(sort_spec); + uint32_t num_rules = Vec_Get_Size(rules); uint32_t action_num = 0; if (!schema) { @@ -61,7 +61,7 @@ HitQ_init(HitQueue *self, Schema *schema, SortSpec *sort_spec, ivars->field_types = (FieldType**)CALLOCATE(num_rules, sizeof(FieldType*)); for (uint32_t i = 0; i < num_rules; i++) { - SortRule *rule = (SortRule*)VA_Fetch(rules, i); + SortRule *rule = (SortRule*)Vec_Fetch(rules, i); int32_t rule_type = SortRule_Get_Type(rule); bool reverse = SortRule_Get_Reverse(rule); @@ -126,7 +126,7 @@ HitQ_Jostle_IMP(HitQueue *self, Obj *element) { = SUPER_METHOD_PTR(HITQUEUE, LUCY_HitQ_Jostle); if (ivars->need_values) { MatchDocIVARS *const match_doc_ivars = MatchDoc_IVARS(match_doc); - CERTIFY(match_doc_ivars->values, VARRAY); + CERTIFY(match_doc_ivars->values, VECTOR); } return super_jostle(self, element); } @@ -134,8 +134,8 @@ HitQ_Jostle_IMP(HitQueue *self, Obj *element) { static CFISH_INLINE int32_t SI_compare_by_value(HitQueueIVARS *ivars, uint32_t tick, MatchDocIVARS *a_ivars, MatchDocIVARS *b_ivars) { - Obj *a_val = VA_Fetch(a_ivars->values, tick); - Obj *b_val = VA_Fetch(b_ivars->values, tick); + Obj *a_val = Vec_Fetch(a_ivars->values, tick); + Obj *b_val = Vec_Fetch(b_ivars->values, tick); FieldType *field_type = ivars->field_types[tick]; return FType_null_back_compare_values(field_type, a_val, b_val); } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/Hits.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/Hits.c b/core/Lucy/Search/Hits.c index fa59246..0bb0439 100644 --- a/core/Lucy/Search/Hits.c +++ b/core/Lucy/Search/Hits.c @@ -36,7 +36,7 @@ Hits_init(Hits *self, Searcher *searcher, TopDocs *top_docs, uint32_t offset) { HitsIVARS *const ivars = Hits_IVARS(self); ivars->searcher = (Searcher*)INCREF(searcher); ivars->top_docs = (TopDocs*)INCREF(top_docs); - ivars->match_docs = (VArray*)INCREF(TopDocs_Get_Match_Docs(top_docs)); + ivars->match_docs = (Vector*)INCREF(TopDocs_Get_Match_Docs(top_docs)); ivars->offset = offset; return self; } @@ -53,7 +53,7 @@ Hits_Destroy_IMP(Hits *self) { HitDoc* Hits_Next_IMP(Hits *self) { HitsIVARS *const ivars = Hits_IVARS(self); - MatchDoc *match_doc = (MatchDoc*)VA_Fetch(ivars->match_docs, ivars->offset); + MatchDoc *match_doc = (MatchDoc*)Vec_Fetch(ivars->match_docs, ivars->offset); ivars->offset++; if (!match_doc) { http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/Hits.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/Hits.cfh b/core/Lucy/Search/Hits.cfh index fa8400a..fd9fac3 100644 --- a/core/Lucy/Search/Hits.cfh +++ b/core/Lucy/Search/Hits.cfh @@ -24,7 +24,7 @@ public class Lucy::Search::Hits inherits Clownfish::Obj { Searcher *searcher; TopDocs *top_docs; - VArray *match_docs; + Vector *match_docs; uint32_t offset; inert incremented Hits* http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/IndexSearcher.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/IndexSearcher.c b/core/Lucy/Search/IndexSearcher.c index 080e6e1..4d2bd8f 100644 --- a/core/Lucy/Search/IndexSearcher.c +++ b/core/Lucy/Search/IndexSearcher.c @@ -119,7 +119,7 @@ IxSearcher_Top_Docs_IMP(IndexSearcher *self, Query *query, uint32_t num_wanted, uint32_t wanted = num_wanted > doc_max ? doc_max : num_wanted; SortCollector *collector = SortColl_new(schema, sort_spec, wanted); IxSearcher_Collect(self, query, (Collector*)collector); - VArray *match_docs = SortColl_Pop_Match_Docs(collector); + Vector *match_docs = SortColl_Pop_Match_Docs(collector); int32_t total_hits = SortColl_Get_Total_Hits(collector); TopDocs *retval = TopDocs_new(match_docs, total_hits); DECREF(collector); @@ -130,7 +130,7 @@ IxSearcher_Top_Docs_IMP(IndexSearcher *self, Query *query, uint32_t num_wanted, void IxSearcher_Collect_IMP(IndexSearcher *self, Query *query, Collector *collector) { IndexSearcherIVARS *const ivars = IxSearcher_IVARS(self); - VArray *const seg_readers = ivars->seg_readers; + Vector *const seg_readers = ivars->seg_readers; I32Array *const seg_starts = ivars->seg_starts; bool need_score = Coll_Need_Score(collector); Compiler *compiler = Query_Is_A(query, COMPILER) @@ -139,8 +139,8 @@ IxSearcher_Collect_IMP(IndexSearcher *self, Query *query, Collector *collector) Query_Get_Boost(query), false); // Accumulate hits into the Collector. - 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)); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/IndexSearcher.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/IndexSearcher.cfh b/core/Lucy/Search/IndexSearcher.cfh index ffd7044..f6d0524 100644 --- a/core/Lucy/Search/IndexSearcher.cfh +++ b/core/Lucy/Search/IndexSearcher.cfh @@ -32,7 +32,7 @@ public class Lucy::Search::IndexSearcher nickname IxSearcher IndexReader *reader; DocReader *doc_reader; HighlightReader *hl_reader; - VArray *seg_readers; + Vector *seg_readers; I32Array *seg_starts; inert incremented IndexSearcher* http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/MatchDoc.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/MatchDoc.c b/core/Lucy/Search/MatchDoc.c index 2797932..9d9190a 100644 --- a/core/Lucy/Search/MatchDoc.c +++ b/core/Lucy/Search/MatchDoc.c @@ -23,17 +23,17 @@ #include "Lucy/Util/Freezer.h" MatchDoc* -MatchDoc_new(int32_t doc_id, float score, VArray *values) { +MatchDoc_new(int32_t doc_id, float score, Vector *values) { MatchDoc *self = (MatchDoc*)Class_Make_Obj(MATCHDOC); return MatchDoc_init(self, doc_id, score, values); } MatchDoc* -MatchDoc_init(MatchDoc *self, int32_t doc_id, float score, VArray *values) { +MatchDoc_init(MatchDoc *self, int32_t doc_id, float score, Vector *values) { MatchDocIVARS *const ivars = MatchDoc_IVARS(self); ivars->doc_id = doc_id; ivars->score = score; - ivars->values = (VArray*)INCREF(values); + ivars->values = (Vector*)INCREF(values); return self; } @@ -74,7 +74,7 @@ MatchDoc_Get_Score_IMP(MatchDoc *self) { return MatchDoc_IVARS(self)->score; } -VArray* +Vector* MatchDoc_Get_Values_IMP(MatchDoc *self) { return MatchDoc_IVARS(self)->values; } @@ -90,10 +90,10 @@ MatchDoc_Set_Score_IMP(MatchDoc *self, float score) { } void -MatchDoc_Set_Values_IMP(MatchDoc *self, VArray *values) { +MatchDoc_Set_Values_IMP(MatchDoc *self, Vector *values) { MatchDocIVARS *const ivars = MatchDoc_IVARS(self); DECREF(ivars->values); - ivars->values = (VArray*)INCREF(values); + ivars->values = (Vector*)INCREF(values); } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/MatchDoc.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/MatchDoc.cfh b/core/Lucy/Search/MatchDoc.cfh index 1e994d5..66150f0 100644 --- a/core/Lucy/Search/MatchDoc.cfh +++ b/core/Lucy/Search/MatchDoc.cfh @@ -23,13 +23,13 @@ class Lucy::Search::MatchDoc inherits Clownfish::Obj { int32_t doc_id; float score; - VArray *values; + Vector *values; inert incremented MatchDoc* - new(int32_t doc_id, float score, VArray *values = NULL); + new(int32_t doc_id, float score, Vector *values = NULL); inert MatchDoc* - init(MatchDoc *self, int32_t doc_id, float score, VArray *values = NULL); + init(MatchDoc *self, int32_t doc_id, float score, Vector *values = NULL); public void Serialize(MatchDoc *self, OutStream *outstream); @@ -49,11 +49,11 @@ class Lucy::Search::MatchDoc inherits Clownfish::Obj { void Set_Score(MatchDoc *self, float score); - nullable VArray* + nullable Vector* Get_Values(MatchDoc *self); void - Set_Values(MatchDoc *self, VArray *values); + Set_Values(MatchDoc *self, Vector *values); public void Destroy(MatchDoc *self); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/NOTMatcher.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/NOTMatcher.c b/core/Lucy/Search/NOTMatcher.c index 327d939..9c7e6ff 100644 --- a/core/Lucy/Search/NOTMatcher.c +++ b/core/Lucy/Search/NOTMatcher.c @@ -30,8 +30,8 @@ NOTMatcher_new(Matcher *negated_matcher, int32_t doc_max) { NOTMatcher* NOTMatcher_init(NOTMatcher *self, Matcher *negated_matcher, int32_t doc_max) { NOTMatcherIVARS *const ivars = NOTMatcher_IVARS(self); - VArray *children = VA_new(1); - VA_Push(children, INCREF(negated_matcher)); + Vector *children = Vec_new(1); + Vec_Push(children, INCREF(negated_matcher)); PolyMatcher_init((PolyMatcher*)self, children, NULL); // Init. http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/NOTQuery.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/NOTQuery.c b/core/Lucy/Search/NOTQuery.c index 74374ff..84c6d80 100644 --- a/core/Lucy/Search/NOTQuery.c +++ b/core/Lucy/Search/NOTQuery.c @@ -44,19 +44,19 @@ NOTQuery_init(NOTQuery *self, Query *negated_query) { Query* NOTQuery_Get_Negated_Query_IMP(NOTQuery *self) { NOTQueryIVARS *const ivars = NOTQuery_IVARS(self); - return (Query*)VA_Fetch(ivars->children, 0); + return (Query*)Vec_Fetch(ivars->children, 0); } void NOTQuery_Set_Negated_Query_IMP(NOTQuery *self, Query *negated_query) { NOTQueryIVARS *const ivars = NOTQuery_IVARS(self); - VA_Store(ivars->children, 0, INCREF(negated_query)); + Vec_Store(ivars->children, 0, INCREF(negated_query)); } String* NOTQuery_To_String_IMP(NOTQuery *self) { NOTQueryIVARS *const ivars = NOTQuery_IVARS(self); - String *neg_string = Obj_To_String(VA_Fetch(ivars->children, 0)); + String *neg_string = Obj_To_String(Vec_Fetch(ivars->children, 0)); String *retval = Str_newf("-%o", neg_string); DECREF(neg_string); return retval; @@ -103,14 +103,14 @@ NOTCompiler_Sum_Of_Squared_Weights_IMP(NOTCompiler *self) { return 0.0f; } -VArray* +Vector* NOTCompiler_Highlight_Spans_IMP(NOTCompiler *self, Searcher *searcher, DocVector *doc_vec, String *field) { UNUSED_VAR(self); UNUSED_VAR(searcher); UNUSED_VAR(doc_vec); UNUSED_VAR(field); - return VA_new(0); + return Vec_new(0); } Matcher* @@ -118,7 +118,7 @@ NOTCompiler_Make_Matcher_IMP(NOTCompiler *self, SegReader *reader, bool need_score) { NOTCompilerIVARS *const ivars = NOTCompiler_IVARS(self); Compiler *negated_compiler - = (Compiler*)CERTIFY(VA_Fetch(ivars->children, 0), COMPILER); + = (Compiler*)CERTIFY(Vec_Fetch(ivars->children, 0), COMPILER); Matcher *negated_matcher = Compiler_Make_Matcher(negated_compiler, reader, false); UNUSED_VAR(need_score); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/NOTQuery.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/NOTQuery.cfh b/core/Lucy/Search/NOTQuery.cfh index 39a0aea..47689d5 100644 --- a/core/Lucy/Search/NOTQuery.cfh +++ b/core/Lucy/Search/NOTQuery.cfh @@ -76,7 +76,7 @@ class Lucy::Search::NOTCompiler public float Sum_Of_Squared_Weights(NOTCompiler *self); - public incremented VArray* + public incremented Vector* Highlight_Spans(NOTCompiler *self, Searcher *searcher, DocVector *doc_vec, String *field); } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/ORMatcher.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/ORMatcher.c b/core/Lucy/Search/ORMatcher.c index 0d30e29..60a344e 100644 --- a/core/Lucy/Search/ORMatcher.c +++ b/core/Lucy/Search/ORMatcher.c @@ -64,20 +64,20 @@ static void S_sift_down(ORMatcher *self, ORMatcherIVARS *ivars); ORMatcher* -ORMatcher_new(VArray *children) { +ORMatcher_new(Vector *children) { ORMatcher *self = (ORMatcher*)Class_Make_Obj(ORMATCHER); return ORMatcher_init(self, children); } static ORMatcher* -S_ormatcher_init2(ORMatcher *self, ORMatcherIVARS *ivars, VArray *children, +S_ormatcher_init2(ORMatcher *self, ORMatcherIVARS *ivars, Vector *children, Similarity *sim) { // Init. PolyMatcher_init((PolyMatcher*)self, children, sim); ivars->size = 0; // Derive. - ivars->max_size = VA_Get_Size(children); + ivars->max_size = Vec_Get_Size(children); // Allocate. ivars->heap = (HeapedMatcherDoc**)CALLOCATE(ivars->max_size + 1, sizeof(HeapedMatcherDoc*)); @@ -95,7 +95,7 @@ S_ormatcher_init2(ORMatcher *self, ORMatcherIVARS *ivars, VArray *children, // Prime queue. for (uint32_t i = 0; i < ivars->max_size; i++) { - Matcher *matcher = (Matcher*)VA_Fetch(children, i); + Matcher *matcher = (Matcher*)Vec_Fetch(children, i); if (matcher) { S_add_element(self, ivars, (Matcher*)INCREF(matcher), 0); } @@ -105,7 +105,7 @@ S_ormatcher_init2(ORMatcher *self, ORMatcherIVARS *ivars, VArray *children, } ORMatcher* -ORMatcher_init(ORMatcher *self, VArray *children) { +ORMatcher_init(ORMatcher *self, Vector *children) { ORMatcherIVARS *const ivars = ORMatcher_IVARS(self); return S_ormatcher_init2(self, ivars, children, NULL); } @@ -293,13 +293,13 @@ static int32_t S_advance_after_current(ORScorer *self, ORScorerIVARS *ivars); ORScorer* -ORScorer_new(VArray *children, Similarity *sim) { +ORScorer_new(Vector *children, Similarity *sim) { ORScorer *self = (ORScorer*)Class_Make_Obj(ORSCORER); return ORScorer_init(self, children, sim); } ORScorer* -ORScorer_init(ORScorer *self, VArray *children, Similarity *sim) { +ORScorer_init(ORScorer *self, Vector *children, Similarity *sim) { ORScorerIVARS *const ivars = ORScorer_IVARS(self); S_ormatcher_init2((ORMatcher*)self, (ORMatcherIVARS*)ivars, children, sim); ivars->doc_id = 0; http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/ORMatcher.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/ORMatcher.cfh b/core/Lucy/Search/ORMatcher.cfh index 39b93fd..89aaab9 100644 --- a/core/Lucy/Search/ORMatcher.cfh +++ b/core/Lucy/Search/ORMatcher.cfh @@ -46,13 +46,13 @@ class Lucy::Search::ORMatcher inherits Lucy::Search::PolyMatcher { uint32_t max_size; inert incremented ORMatcher* - new(VArray *children); + new(Vector *children); /** * @param children An array of Matchers. */ inert incremented ORMatcher* - init(ORMatcher *self, VArray *children); + init(ORMatcher *self, Vector *children); public void Destroy(ORMatcher *self); @@ -79,10 +79,10 @@ class Lucy::Search::ORScorer inherits Lucy::Search::ORMatcher { int32_t doc_id; inert incremented ORScorer* - new(VArray *children, Similarity *similarity); + new(Vector *children, Similarity *similarity); inert ORScorer* - init(ORScorer *self, VArray *children, Similarity *similarity); + init(ORScorer *self, Vector *children, Similarity *similarity); public void Destroy(ORScorer *self); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/ORQuery.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/ORQuery.c b/core/Lucy/Search/ORQuery.c index 78a2850..54b9791 100644 --- a/core/Lucy/Search/ORQuery.c +++ b/core/Lucy/Search/ORQuery.c @@ -29,13 +29,13 @@ #include "Lucy/Store/OutStream.h" ORQuery* -ORQuery_new(VArray *children) { +ORQuery_new(Vector *children) { ORQuery *self = (ORQuery*)Class_Make_Obj(ORQUERY); return ORQuery_init(self, children); } ORQuery* -ORQuery_init(ORQuery *self, VArray *children) { +ORQuery_init(ORQuery *self, Vector *children) { return (ORQuery*)PolyQuery_init((PolyQuery*)self, children); } @@ -61,13 +61,13 @@ ORQuery_Equals_IMP(ORQuery *self, Obj *other) { String* ORQuery_To_String_IMP(ORQuery *self) { ORQueryIVARS *const ivars = ORQuery_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); uint32_t last_kid = num_kids - 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 == last_kid) { @@ -103,23 +103,23 @@ Matcher* ORCompiler_Make_Matcher_IMP(ORCompiler *self, SegReader *reader, bool need_score) { ORCompilerIVARS *const ivars = ORCompiler_IVARS(self); - uint32_t num_kids = VA_Get_Size(ivars->children); + uint32_t num_kids = Vec_Get_Size(ivars->children); if (num_kids == 1) { // No need for an ORMatcher wrapper. - 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 *submatchers = VA_new(num_kids); + Vector *submatchers = Vec_new(num_kids); uint32_t num_submatchers = 0; // Accumulate sub-matchers. 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 *submatcher = Compiler_Make_Matcher(child, reader, need_score); - VA_Push(submatchers, (Obj*)submatcher); + Vec_Push(submatchers, (Obj*)submatcher); if (submatcher != NULL) { num_submatchers++; } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/ORQuery.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/ORQuery.cfh b/core/Lucy/Search/ORQuery.cfh index 9f0fca1..aa38656 100644 --- a/core/Lucy/Search/ORQuery.cfh +++ b/core/Lucy/Search/ORQuery.cfh @@ -27,13 +27,13 @@ parcel Lucy; public class Lucy::Search::ORQuery inherits Lucy::Search::PolyQuery { inert incremented ORQuery* - new(VArray *children = NULL); + new(Vector *children = NULL); /** * @param children An array of child Queries. */ public inert ORQuery* - init(ORQuery *self, VArray *children = NULL); + init(ORQuery *self, Vector *children = NULL); public incremented Compiler* Make_Compiler(ORQuery *self, Searcher *searcher, float boost, http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PhraseMatcher.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PhraseMatcher.c b/core/Lucy/Search/PhraseMatcher.c index 936fad1..7ca4781 100644 --- a/core/Lucy/Search/PhraseMatcher.c +++ b/core/Lucy/Search/PhraseMatcher.c @@ -26,14 +26,14 @@ #include "Lucy/Search/Compiler.h" PhraseMatcher* -PhraseMatcher_new(Similarity *sim, VArray *plists, Compiler *compiler) { +PhraseMatcher_new(Similarity *sim, Vector *plists, Compiler *compiler) { PhraseMatcher *self = (PhraseMatcher*)Class_Make_Obj(PHRASEMATCHER); return PhraseMatcher_init(self, sim, plists, compiler); } PhraseMatcher* -PhraseMatcher_init(PhraseMatcher *self, Similarity *similarity, VArray *plists, +PhraseMatcher_init(PhraseMatcher *self, Similarity *similarity, Vector *plists, Compiler *compiler) { Matcher_init((Matcher*)self); PhraseMatcherIVARS *const ivars = PhraseMatcher_IVARS(self); @@ -45,13 +45,13 @@ PhraseMatcher_init(PhraseMatcher *self, Similarity *similarity, VArray *plists, ivars->first_time = true; ivars->more = true; - // Extract PostingLists out of VArray into local C array for quick access. - ivars->num_elements = VA_Get_Size(plists); + // Extract PostingLists out of Vector into local C array for quick access. + ivars->num_elements = Vec_Get_Size(plists); ivars->plists = (PostingList**)MALLOCATE( ivars->num_elements * sizeof(PostingList*)); for (size_t i = 0; i < ivars->num_elements; i++) { PostingList *const plist - = (PostingList*)CERTIFY(VA_Fetch(plists, i), POSTINGLIST); + = (PostingList*)CERTIFY(Vec_Fetch(plists, i), POSTINGLIST); if (plist == NULL) { THROW(ERR, "Missing element %u32", i); } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PhraseMatcher.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PhraseMatcher.cfh b/core/Lucy/Search/PhraseMatcher.cfh index d1179c8..e522a60 100644 --- a/core/Lucy/Search/PhraseMatcher.cfh +++ b/core/Lucy/Search/PhraseMatcher.cfh @@ -34,10 +34,10 @@ class Lucy::Search::PhraseMatcher inherits Lucy::Search::Matcher { bool more; inert incremented PhraseMatcher* - new(Similarity *similarity, VArray *posting_lists, Compiler *compiler); + new(Similarity *similarity, Vector *posting_lists, Compiler *compiler); inert PhraseMatcher* - init(PhraseMatcher *self, Similarity *similarity, VArray *posting_lists, + init(PhraseMatcher *self, Similarity *similarity, Vector *posting_lists, Compiler *compiler); public void http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PhraseQuery.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c index cd5cabb..0884532 100644 --- a/core/Lucy/Search/PhraseQuery.c +++ b/core/Lucy/Search/PhraseQuery.c @@ -43,17 +43,17 @@ // Shared initialization routine which assumes that it's ok to assume control // over [field] and [terms], eating their refcounts. static PhraseQuery* -S_do_init(PhraseQuery *self, String *field, VArray *terms, float boost); +S_do_init(PhraseQuery *self, String *field, Vector *terms, float boost); PhraseQuery* -PhraseQuery_new(String *field, VArray *terms) { +PhraseQuery_new(String *field, Vector *terms) { PhraseQuery *self = (PhraseQuery*)Class_Make_Obj(PHRASEQUERY); return PhraseQuery_init(self, field, terms); } PhraseQuery* -PhraseQuery_init(PhraseQuery *self, String *field, VArray *terms) { - return S_do_init(self, Str_Clone(field), VA_Clone(terms), 1.0f); +PhraseQuery_init(PhraseQuery *self, String *field, Vector *terms) { + return S_do_init(self, Str_Clone(field), Vec_Clone(terms), 1.0f); } void @@ -65,11 +65,11 @@ PhraseQuery_Destroy_IMP(PhraseQuery *self) { } static PhraseQuery* -S_do_init(PhraseQuery *self, String *field, VArray *terms, float boost) { +S_do_init(PhraseQuery *self, String *field, Vector *terms, float boost) { Query_init((Query*)self, boost); PhraseQueryIVARS *const ivars = PhraseQuery_IVARS(self); - for (uint32_t i = 0, max = VA_Get_Size(terms); i < max; i++) { - CERTIFY(VA_Fetch(terms, i), OBJ); + for (uint32_t i = 0, max = Vec_Get_Size(terms); i < max; i++) { + CERTIFY(Vec_Fetch(terms, i), OBJ); } ivars->field = field; ivars->terms = terms; @@ -88,7 +88,7 @@ PhraseQuery* PhraseQuery_Deserialize_IMP(PhraseQuery *self, InStream *instream) { float boost = InStream_Read_F32(instream); String *field = Freezer_read_string(instream); - VArray *terms = Freezer_read_varray(instream); + Vector *terms = Freezer_read_varray(instream); return S_do_init(self, field, terms, boost); } @@ -115,7 +115,7 @@ PhraseQuery_Load_IMP(PhraseQuery *self, Obj *dump) { = (String*)CERTIFY(Freezer_load(field), STRING); Obj *terms = CERTIFY(Hash_Fetch_Utf8(source, "terms", 5), OBJ); loaded_ivars->terms - = (VArray*)CERTIFY(Freezer_load(terms), VARRAY); + = (Vector*)CERTIFY(Freezer_load(terms), VECTOR); return (Obj*)loaded; } @@ -131,18 +131,18 @@ PhraseQuery_Equals_IMP(PhraseQuery *self, Obj *other) { if (ivars->field && !Str_Equals(ivars->field, (Obj*)ovars->field)) { return false; } - if (!VA_Equals(ovars->terms, (Obj*)ivars->terms)) { return false; } + if (!Vec_Equals(ovars->terms, (Obj*)ivars->terms)) { return false; } return true; } String* PhraseQuery_To_String_IMP(PhraseQuery *self) { PhraseQueryIVARS *const ivars = PhraseQuery_IVARS(self); - uint32_t num_terms = VA_Get_Size(ivars->terms); + uint32_t num_terms = Vec_Get_Size(ivars->terms); CharBuf *buf = CB_new_from_str(ivars->field); CB_Cat_Trusted_Utf8(buf, ":\"", 2); for (uint32_t i = 0; i < num_terms; i++) { - Obj *term = VA_Fetch(ivars->terms, i); + Obj *term = Vec_Fetch(ivars->terms, i); String *term_string = Obj_To_String(term); CB_Cat(buf, term_string); DECREF(term_string); @@ -160,9 +160,9 @@ Compiler* PhraseQuery_Make_Compiler_IMP(PhraseQuery *self, Searcher *searcher, float boost, bool subordinate) { PhraseQueryIVARS *const ivars = PhraseQuery_IVARS(self); - if (VA_Get_Size(ivars->terms) == 1) { + if (Vec_Get_Size(ivars->terms) == 1) { // Optimize for one-term "phrases". - Obj *term = VA_Fetch(ivars->terms, 0); + Obj *term = Vec_Fetch(ivars->terms, 0); TermQuery *term_query = TermQuery_new(ivars->field, term); TermCompiler *term_compiler; TermQuery_Set_Boost(term_query, ivars->boost); @@ -187,7 +187,7 @@ PhraseQuery_Get_Field_IMP(PhraseQuery *self) { return PhraseQuery_IVARS(self)->field; } -VArray* +Vector* PhraseQuery_Get_Terms_IMP(PhraseQuery *self) { return PhraseQuery_IVARS(self)->terms; } @@ -207,7 +207,7 @@ PhraseCompiler_init(PhraseCompiler *self, PhraseQuery *parent, PhraseQueryIVARS *const parent_ivars = PhraseQuery_IVARS(parent); Schema *schema = Searcher_Get_Schema(searcher); Similarity *sim = Schema_Fetch_Sim(schema, parent_ivars->field); - VArray *terms = parent_ivars->terms; + Vector *terms = parent_ivars->terms; // Try harder to find a Similarity if necessary. if (!sim) { sim = Schema_Get_Similarity(schema); } @@ -217,8 +217,8 @@ PhraseCompiler_init(PhraseCompiler *self, PhraseQuery *parent, // Store IDF for the phrase. ivars->idf = 0; - for (uint32_t i = 0, max = VA_Get_Size(terms); i < max; i++) { - Obj *term = VA_Fetch(terms, i); + for (uint32_t i = 0, max = Vec_Get_Size(terms); i < max; i++) { + Obj *term = Vec_Fetch(terms, i); int32_t doc_max = Searcher_Doc_Max(searcher); int32_t doc_freq = Searcher_Doc_Freq(searcher, parent_ivars->field, term); ivars->idf += Sim_IDF(sim, doc_freq, doc_max); @@ -298,8 +298,8 @@ PhraseCompiler_Make_Matcher_IMP(PhraseCompiler *self, SegReader *reader, PhraseCompilerIVARS *const ivars = PhraseCompiler_IVARS(self); PhraseQueryIVARS *const parent_ivars = PhraseQuery_IVARS((PhraseQuery*)ivars->parent); - VArray *const terms = parent_ivars->terms; - uint32_t num_terms = VA_Get_Size(terms); + Vector *const terms = parent_ivars->terms; + uint32_t num_terms = Vec_Get_Size(terms); // Bail if there are no terms. if (!num_terms) { return NULL; } @@ -320,9 +320,9 @@ PhraseCompiler_Make_Matcher_IMP(PhraseCompiler *self, SegReader *reader, if (!plist_reader) { return NULL; } // Look up each term. - VArray *plists = VA_new(num_terms); + Vector *plists = Vec_new(num_terms); for (uint32_t i = 0; i < num_terms; i++) { - Obj *term = VA_Fetch(terms, i); + Obj *term = Vec_Fetch(terms, i); PostingList *plist = PListReader_Posting_List(plist_reader, parent_ivars->field, term); @@ -332,7 +332,7 @@ PhraseCompiler_Make_Matcher_IMP(PhraseCompiler *self, SegReader *reader, DECREF(plists); return NULL; } - VA_Push(plists, (Obj*)plist); + Vec_Push(plists, (Obj*)plist); } Matcher *retval @@ -341,26 +341,26 @@ PhraseCompiler_Make_Matcher_IMP(PhraseCompiler *self, SegReader *reader, return retval; } -VArray* +Vector* PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher, DocVector *doc_vec, String *field) { PhraseCompilerIVARS *const ivars = PhraseCompiler_IVARS(self); PhraseQueryIVARS *const parent_ivars = PhraseQuery_IVARS((PhraseQuery*)ivars->parent); - VArray *const terms = parent_ivars->terms; - VArray *const spans = VA_new(0); - const uint32_t num_terms = VA_Get_Size(terms); + Vector *const terms = parent_ivars->terms; + Vector *const spans = Vec_new(0); + const uint32_t num_terms = Vec_Get_Size(terms); UNUSED_VAR(searcher); // Bail if no terms or field doesn't match. if (!num_terms) { return spans; } if (!Str_Equals(field, (Obj*)parent_ivars->field)) { return spans; } - VArray *term_vectors = VA_new(num_terms); + Vector *term_vectors = Vec_new(num_terms); BitVector *posit_vec = BitVec_new(0); BitVector *other_posit_vec = BitVec_new(0); for (uint32_t i = 0; i < num_terms; i++) { - Obj *term = VA_Fetch(terms, i); + Obj *term = Vec_Fetch(terms, i); TermVector *term_vector = DocVec_Term_Vector(doc_vec, field, (String*)term); @@ -369,7 +369,7 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher, break; } - VA_Push(term_vectors, (Obj*)term_vector); + Vec_Push(term_vectors, (Obj*)term_vector); if (i == 0) { // Set initial positions from first term. @@ -394,11 +394,11 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher, } // Proceed only if all terms are present. - uint32_t num_tvs = VA_Get_Size(term_vectors); + uint32_t num_tvs = Vec_Get_Size(term_vectors); if (num_tvs == num_terms) { - TermVector *first_tv = (TermVector*)VA_Fetch(term_vectors, 0); + TermVector *first_tv = (TermVector*)Vec_Fetch(term_vectors, 0); TermVector *last_tv - = (TermVector*)VA_Fetch(term_vectors, num_tvs - 1); + = (TermVector*)Vec_Fetch(term_vectors, num_tvs - 1); I32Array *tv_start_positions = TV_Get_Positions(first_tv); I32Array *tv_end_positions = TV_Get_Positions(last_tv); I32Array *tv_start_offsets = TV_Get_Start_Offsets(first_tv); @@ -429,7 +429,7 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher, } } - VA_Push(spans, (Obj*)Span_new(start_offset, + Vec_Push(spans, (Obj*)Span_new(start_offset, end_offset - start_offset, weight)); i++, j++; http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PhraseQuery.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PhraseQuery.cfh b/core/Lucy/Search/PhraseQuery.cfh index b19f9a0..a778e15 100644 --- a/core/Lucy/Search/PhraseQuery.cfh +++ b/core/Lucy/Search/PhraseQuery.cfh @@ -25,17 +25,17 @@ parcel Lucy; public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query { String *field; - VArray *terms; + Vector *terms; inert incremented PhraseQuery* - new(String *field, VArray *terms); + new(String *field, Vector *terms); /** * @param field The field that the phrase must occur in. * @param terms The ordered array of terms that must match. */ public inert PhraseQuery* - init(PhraseQuery *self, String *field, VArray *terms); + init(PhraseQuery *self, String *field, Vector *terms); /** Accessor for object's field attribute. */ @@ -44,7 +44,7 @@ public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query { /** Accessor for object's array of terms. */ - public VArray* + public Vector* Get_Terms(PhraseQuery *self); public incremented Compiler* @@ -100,7 +100,7 @@ class Lucy::Search::PhraseCompiler public void Apply_Norm_Factor(PhraseCompiler *self, float factor); - public incremented VArray* + public incremented Vector* Highlight_Spans(PhraseCompiler *self, Searcher *searcher, DocVector *doc_vec, String *field); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PolyMatcher.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PolyMatcher.c b/core/Lucy/Search/PolyMatcher.c index e19e8e8..444d53c 100644 --- a/core/Lucy/Search/PolyMatcher.c +++ b/core/Lucy/Search/PolyMatcher.c @@ -21,18 +21,18 @@ #include "Lucy/Index/Similarity.h" PolyMatcher* -PolyMatcher_new(VArray *children, Similarity *sim) { +PolyMatcher_new(Vector *children, Similarity *sim) { PolyMatcher *self = (PolyMatcher*)Class_Make_Obj(POLYMATCHER); return PolyMatcher_init(self, children, sim); } PolyMatcher* -PolyMatcher_init(PolyMatcher *self, VArray *children, Similarity *similarity) { +PolyMatcher_init(PolyMatcher *self, Vector *children, Similarity *similarity) { Matcher_init((Matcher*)self); PolyMatcherIVARS *const ivars = PolyMatcher_IVARS(self); - ivars->num_kids = VA_Get_Size(children); + ivars->num_kids = Vec_Get_Size(children); ivars->sim = (Similarity*)INCREF(similarity); - ivars->children = (VArray*)INCREF(children); + ivars->children = (Vector*)INCREF(children); ivars->coord_factors = (float*)MALLOCATE((ivars->num_kids + 1) * sizeof(float)); for (uint32_t i = 0; i <= ivars->num_kids; i++) { ivars->coord_factors[i] = similarity http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PolyMatcher.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PolyMatcher.cfh b/core/Lucy/Search/PolyMatcher.cfh index 006a1d0..9b9c9c8 100644 --- a/core/Lucy/Search/PolyMatcher.cfh +++ b/core/Lucy/Search/PolyMatcher.cfh @@ -21,17 +21,17 @@ parcel Lucy; class Lucy::Search::PolyMatcher inherits Lucy::Search::Matcher { - VArray *children; + Vector *children; Similarity *sim; uint32_t num_kids; uint32_t matching_kids; float *coord_factors; inert incremented PolyMatcher* - new(VArray *children, Similarity *similarity); + new(Vector *children, Similarity *similarity); inert PolyMatcher* - init(PolyMatcher *self, VArray *children, Similarity *similarity); + init(PolyMatcher *self, Vector *children, Similarity *similarity); public void Destroy(PolyMatcher *self); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PolyQuery.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c index 18b1626..2372f44 100644 --- a/core/Lucy/Search/PolyQuery.c +++ b/core/Lucy/Search/PolyQuery.c @@ -29,13 +29,13 @@ #include "Lucy/Util/Freezer.h" PolyQuery* -PolyQuery_init(PolyQuery *self, VArray *children) { - const uint32_t num_kids = children ? VA_Get_Size(children) : 0; +PolyQuery_init(PolyQuery *self, Vector *children) { + const uint32_t num_kids = children ? Vec_Get_Size(children) : 0; Query_init((Query*)self, 1.0f); PolyQueryIVARS *const ivars = PolyQuery_IVARS(self); - ivars->children = VA_new(num_kids); + ivars->children = Vec_new(num_kids); for (uint32_t i = 0; i < num_kids; i++) { - PolyQuery_Add_Child(self, (Query*)VA_Fetch(children, i)); + PolyQuery_Add_Child(self, (Query*)Vec_Fetch(children, i)); } return self; } @@ -51,17 +51,17 @@ void PolyQuery_Add_Child_IMP(PolyQuery *self, Query *query) { CERTIFY(query, QUERY); PolyQueryIVARS *const ivars = PolyQuery_IVARS(self); - VA_Push(ivars->children, INCREF(query)); + Vec_Push(ivars->children, INCREF(query)); } void -PolyQuery_Set_Children_IMP(PolyQuery *self, VArray *children) { +PolyQuery_Set_Children_IMP(PolyQuery *self, Vector *children) { PolyQueryIVARS *const ivars = PolyQuery_IVARS(self); DECREF(ivars->children); - ivars->children = (VArray*)INCREF(children); + ivars->children = (Vector*)INCREF(children); } -VArray* +Vector* PolyQuery_Get_Children_IMP(PolyQuery *self) { return PolyQuery_IVARS(self)->children; } @@ -69,11 +69,11 @@ PolyQuery_Get_Children_IMP(PolyQuery *self) { void PolyQuery_Serialize_IMP(PolyQuery *self, OutStream *outstream) { PolyQueryIVARS *const ivars = PolyQuery_IVARS(self); - const uint32_t num_kids = VA_Get_Size(ivars->children); + const uint32_t num_kids = Vec_Get_Size(ivars->children); OutStream_Write_F32(outstream, ivars->boost); OutStream_Write_U32(outstream, num_kids); for (uint32_t i = 0; i < num_kids; i++) { - Query *child = (Query*)VA_Fetch(ivars->children, i); + Query *child = (Query*)Vec_Fetch(ivars->children, i); FREEZE(child, outstream); } } @@ -85,9 +85,9 @@ PolyQuery_Deserialize_IMP(PolyQuery *self, InStream *instream) { PolyQuery_init(self, NULL); PolyQueryIVARS *const ivars = PolyQuery_IVARS(self); PolyQuery_Set_Boost(self, boost); - VA_Grow(ivars->children, num_children); + Vec_Grow(ivars->children, num_children); while (num_children--) { - VA_Push(ivars->children, THAW(instream)); + Vec_Push(ivars->children, THAW(instream)); } return self; } @@ -110,7 +110,7 @@ PolyQuery_Load_IMP(PolyQuery *self, Obj *dump) { PolyQuery *loaded = (PolyQuery*)super_load(self, dump); Obj *children = CERTIFY(Hash_Fetch_Utf8(source, "children", 8), OBJ); PolyQuery_IVARS(loaded)->children - = (VArray*)CERTIFY(Freezer_load(children), VARRAY); + = (Vector*)CERTIFY(Freezer_load(children), VECTOR); return (Obj*)loaded; } @@ -121,7 +121,7 @@ PolyQuery_Equals_IMP(PolyQuery *self, Obj *other) { PolyQueryIVARS *const ivars = PolyQuery_IVARS(self); PolyQueryIVARS *const ovars = PolyQuery_IVARS((PolyQuery*)other); if (ivars->boost != ovars->boost) { return false; } - if (!VA_Equals(ovars->children, (Obj*)ivars->children)) { return false; } + if (!Vec_Equals(ovars->children, (Obj*)ivars->children)) { return false; } return true; } @@ -133,18 +133,18 @@ PolyCompiler_init(PolyCompiler *self, PolyQuery *parent, Searcher *searcher, float boost) { PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self); PolyQueryIVARS *const parent_ivars = PolyQuery_IVARS(parent); - const uint32_t num_kids = VA_Get_Size(parent_ivars->children); + const uint32_t num_kids = Vec_Get_Size(parent_ivars->children); Compiler_init((Compiler*)self, (Query*)parent, searcher, NULL, boost); - ivars->children = VA_new(num_kids); + ivars->children = Vec_new(num_kids); // Iterate over the children, creating a Compiler for each one. for (uint32_t i = 0; i < num_kids; i++) { - Query *child_query = (Query*)VA_Fetch(parent_ivars->children, i); + Query *child_query = (Query*)Vec_Fetch(parent_ivars->children, i); float sub_boost = boost * Query_Get_Boost(child_query); Compiler *child_compiler = Query_Make_Compiler(child_query, searcher, sub_boost, true); - VA_Push(ivars->children, (Obj*)child_compiler); + Vec_Push(ivars->children, (Obj*)child_compiler); } return self; @@ -163,8 +163,8 @@ PolyCompiler_Sum_Of_Squared_Weights_IMP(PolyCompiler *self) { float sum = 0; float my_boost = PolyCompiler_Get_Boost(self); - for (uint32_t i = 0, max = VA_Get_Size(ivars->children); i < max; i++) { - Compiler *child = (Compiler*)VA_Fetch(ivars->children, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->children); i < max; i++) { + Compiler *child = (Compiler*)Vec_Fetch(ivars->children, i); sum += Compiler_Sum_Of_Squared_Weights(child); } @@ -177,23 +177,23 @@ PolyCompiler_Sum_Of_Squared_Weights_IMP(PolyCompiler *self) { void PolyCompiler_Apply_Norm_Factor_IMP(PolyCompiler *self, float factor) { PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self); - for (uint32_t i = 0, max = VA_Get_Size(ivars->children); i < max; i++) { - Compiler *child = (Compiler*)VA_Fetch(ivars->children, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->children); i < max; i++) { + Compiler *child = (Compiler*)Vec_Fetch(ivars->children, i); Compiler_Apply_Norm_Factor(child, factor); } } -VArray* +Vector* PolyCompiler_Highlight_Spans_IMP(PolyCompiler *self, Searcher *searcher, DocVector *doc_vec, String *field) { PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self); - VArray *spans = VA_new(0); - for (uint32_t i = 0, max = VA_Get_Size(ivars->children); i < max; i++) { - Compiler *child = (Compiler*)VA_Fetch(ivars->children, i); - VArray *child_spans = Compiler_Highlight_Spans(child, searcher, + Vector *spans = Vec_new(0); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->children); i < max; i++) { + Compiler *child = (Compiler*)Vec_Fetch(ivars->children, i); + Vector *child_spans = Compiler_Highlight_Spans(child, searcher, doc_vec, field); if (child_spans) { - VA_Push_All(spans, child_spans); + Vec_Push_All(spans, child_spans); DECREF(child_spans); } } http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PolyQuery.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PolyQuery.cfh b/core/Lucy/Search/PolyQuery.cfh index 3b8f7f1..7a9f6f8 100644 --- a/core/Lucy/Search/PolyQuery.cfh +++ b/core/Lucy/Search/PolyQuery.cfh @@ -28,13 +28,13 @@ parcel Lucy; */ public abstract class Lucy::Search::PolyQuery inherits Lucy::Search::Query { - VArray *children; + Vector *children; /** * @param children An array of child Queries. */ public inert PolyQuery* - init(PolyQuery *self, VArray *children = NULL); + init(PolyQuery *self, Vector *children = NULL); /** Add a child Query node. */ @@ -42,9 +42,9 @@ public abstract class Lucy::Search::PolyQuery inherits Lucy::Search::Query { Add_Child(PolyQuery *self, Query *query); void - Set_Children(PolyQuery *self, VArray *children); + Set_Children(PolyQuery *self, Vector *children); - VArray* + Vector* Get_Children(PolyQuery *self); public void @@ -68,7 +68,7 @@ public abstract class Lucy::Search::PolyQuery inherits Lucy::Search::Query { class Lucy::Search::PolyCompiler inherits Lucy::Search::Compiler { - VArray *children; + Vector *children; inert incremented PolyCompiler* new(PolyQuery *parent, Searcher *searcher, float boost); @@ -86,7 +86,7 @@ class Lucy::Search::PolyCompiler inherits Lucy::Search::Compiler { public void Apply_Norm_Factor(PolyCompiler *self, float factor); - public incremented VArray* + public incremented Vector* Highlight_Spans(PolyCompiler *self, Searcher *searcher, DocVector *doc_vec, String *field); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PolySearcher.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PolySearcher.c b/core/Lucy/Search/PolySearcher.c index 6c80b87..d0af055 100644 --- a/core/Lucy/Search/PolySearcher.c +++ b/core/Lucy/Search/PolySearcher.c @@ -34,19 +34,19 @@ #include "Lucy/Search/Compiler.h" PolySearcher* -PolySearcher_init(PolySearcher *self, Schema *schema, VArray *searchers) { - const uint32_t num_searchers = VA_Get_Size(searchers); +PolySearcher_init(PolySearcher *self, Schema *schema, Vector *searchers) { + const uint32_t num_searchers = Vec_Get_Size(searchers); int32_t *starts_array = (int32_t*)MALLOCATE(num_searchers * sizeof(int32_t)); int32_t doc_max = 0; Searcher_init((Searcher*)self, schema); PolySearcherIVARS *const ivars = PolySearcher_IVARS(self); - ivars->searchers = (VArray*)INCREF(searchers); + ivars->searchers = (Vector*)INCREF(searchers); ivars->starts = NULL; // Safe cleanup. for (uint32_t i = 0; i < num_searchers; i++) { Searcher *searcher - = (Searcher*)CERTIFY(VA_Fetch(searchers, i), SEARCHER); + = (Searcher*)CERTIFY(Vec_Fetch(searchers, i), SEARCHER); Schema *candidate = Searcher_Get_Schema(searcher); Class *orig_class = Schema_Get_Class(schema); Class *candidate_class = Schema_Get_Class(candidate); @@ -81,7 +81,7 @@ HitDoc* PolySearcher_Fetch_Doc_IMP(PolySearcher *self, int32_t doc_id) { PolySearcherIVARS *const ivars = PolySearcher_IVARS(self); uint32_t tick = PolyReader_sub_tick(ivars->starts, doc_id); - Searcher *searcher = (Searcher*)VA_Fetch(ivars->searchers, tick); + Searcher *searcher = (Searcher*)Vec_Fetch(ivars->searchers, tick); int32_t offset = I32Arr_Get(ivars->starts, tick); if (!searcher) { THROW(ERR, "Invalid doc id: %i32", doc_id); } HitDoc *hit_doc = Searcher_Fetch_Doc(searcher, doc_id - offset); @@ -93,7 +93,7 @@ DocVector* PolySearcher_Fetch_Doc_Vec_IMP(PolySearcher *self, int32_t doc_id) { PolySearcherIVARS *const ivars = PolySearcher_IVARS(self); uint32_t tick = PolyReader_sub_tick(ivars->starts, doc_id); - Searcher *searcher = (Searcher*)VA_Fetch(ivars->searchers, tick); + Searcher *searcher = (Searcher*)Vec_Fetch(ivars->searchers, tick); int32_t start = I32Arr_Get(ivars->starts, tick); if (!searcher) { THROW(ERR, "Invalid doc id: %i32", doc_id); } return Searcher_Fetch_Doc_Vec(searcher, doc_id - start); @@ -108,17 +108,17 @@ uint32_t PolySearcher_Doc_Freq_IMP(PolySearcher *self, String *field, Obj *term) { PolySearcherIVARS *const ivars = PolySearcher_IVARS(self); uint32_t doc_freq = 0; - for (uint32_t i = 0, max = VA_Get_Size(ivars->searchers); i < max; i++) { - Searcher *searcher = (Searcher*)VA_Fetch(ivars->searchers, i); + for (uint32_t i = 0, max = Vec_Get_Size(ivars->searchers); i < max; i++) { + Searcher *searcher = (Searcher*)Vec_Fetch(ivars->searchers, i); doc_freq += Searcher_Doc_Freq(searcher, field, term); } return doc_freq; } static void -S_modify_doc_ids(VArray *match_docs, int32_t base) { - for (uint32_t i = 0, max = VA_Get_Size(match_docs); i < max; i++) { - MatchDoc *match_doc = (MatchDoc*)VA_Fetch(match_docs, i); +S_modify_doc_ids(Vector *match_docs, int32_t base) { + for (uint32_t i = 0, max = Vec_Get_Size(match_docs); i < max; i++) { + MatchDoc *match_doc = (MatchDoc*)Vec_Fetch(match_docs, i); int32_t new_doc_id = MatchDoc_Get_Doc_ID(match_doc) + base; MatchDoc_Set_Doc_ID(match_doc, new_doc_id); } @@ -129,7 +129,7 @@ PolySearcher_Top_Docs_IMP(PolySearcher *self, Query *query, uint32_t num_wanted, SortSpec *sort_spec) { PolySearcherIVARS *const ivars = PolySearcher_IVARS(self); Schema *schema = PolySearcher_Get_Schema(self); - VArray *searchers = ivars->searchers; + Vector *searchers = ivars->searchers; I32Array *starts = ivars->starts; HitQueue *hit_q = sort_spec ? HitQ_new(schema, sort_spec, num_wanted) @@ -141,25 +141,25 @@ PolySearcher_Top_Docs_IMP(PolySearcher *self, Query *query, Query_Get_Boost(query), false); - for (uint32_t i = 0, max = VA_Get_Size(searchers); i < max; i++) { - Searcher *searcher = (Searcher*)VA_Fetch(searchers, i); + for (uint32_t i = 0, max = Vec_Get_Size(searchers); i < max; i++) { + Searcher *searcher = (Searcher*)Vec_Fetch(searchers, i); int32_t base = I32Arr_Get(starts, i); TopDocs *top_docs = Searcher_Top_Docs(searcher, (Query*)compiler, num_wanted, sort_spec); - VArray *sub_match_docs = TopDocs_Get_Match_Docs(top_docs); + Vector *sub_match_docs = TopDocs_Get_Match_Docs(top_docs); total_hits += TopDocs_Get_Total_Hits(top_docs); S_modify_doc_ids(sub_match_docs, base); - for (uint32_t j = 0, jmax = VA_Get_Size(sub_match_docs); j < jmax; j++) { - MatchDoc *match_doc = (MatchDoc*)VA_Fetch(sub_match_docs, j); + for (uint32_t j = 0, jmax = Vec_Get_Size(sub_match_docs); j < jmax; j++) { + MatchDoc *match_doc = (MatchDoc*)Vec_Fetch(sub_match_docs, j); if (!HitQ_Insert(hit_q, INCREF(match_doc))) { break; } } DECREF(top_docs); } - VArray *match_docs = HitQ_Pop_All(hit_q); + Vector *match_docs = HitQ_Pop_All(hit_q); TopDocs *retval = TopDocs_new(match_docs, total_hits); DECREF(match_docs); @@ -173,12 +173,12 @@ void PolySearcher_Collect_IMP(PolySearcher *self, Query *query, Collector *collector) { PolySearcherIVARS *const ivars = PolySearcher_IVARS(self); - VArray *const searchers = ivars->searchers; + Vector *const searchers = ivars->searchers; I32Array *starts = ivars->starts; - for (uint32_t i = 0, max = VA_Get_Size(searchers); i < max; i++) { + for (uint32_t i = 0, max = Vec_Get_Size(searchers); i < max; i++) { int32_t start = I32Arr_Get(starts, i); - Searcher *searcher = (Searcher*)VA_Fetch(searchers, i); + Searcher *searcher = (Searcher*)Vec_Fetch(searchers, i); OffsetCollector *offset_coll = OffsetColl_new(collector, start); Searcher_Collect(searcher, query, (Collector*)offset_coll); DECREF(offset_coll); http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/Lucy/Search/PolySearcher.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PolySearcher.cfh b/core/Lucy/Search/PolySearcher.cfh index 2c4a82e..8774c7e 100644 --- a/core/Lucy/Search/PolySearcher.cfh +++ b/core/Lucy/Search/PolySearcher.cfh @@ -25,19 +25,19 @@ parcel Lucy; public class Lucy::Search::PolySearcher inherits Lucy::Search::Searcher { - VArray *searchers; + Vector *searchers; I32Array *starts; int32_t doc_max; inert incremented PolySearcher* - new(Schema *schema, VArray *searchers); + new(Schema *schema, Vector *searchers); /** * @param schema A Schema. * @param searchers An array of Searchers. */ public inert PolySearcher* - init(PolySearcher *self, Schema *schema, VArray *searchers); + init(PolySearcher *self, Schema *schema, Vector *searchers); public void Destroy(PolySearcher *self);
