lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [07/14] lucy git commit: Rename VArray to Vector
Date Wed, 29 Apr 2015 19:56:28 GMT
http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c b/core/LucyX/Search/ProximityQuery.c
index 8a3fbe7..027d106 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -43,19 +43,19 @@
 // Shared initialization routine which assumes that it's ok to assume control
 // over [field] and [terms], eating their refcounts.
 static ProximityQuery*
-S_do_init(ProximityQuery *self, String *field, VArray *terms, float boost,
+S_do_init(ProximityQuery *self, String *field, Vector *terms, float boost,
           uint32_t within);
 
 ProximityQuery*
-ProximityQuery_new(String *field, VArray *terms, uint32_t within) {
+ProximityQuery_new(String *field, Vector *terms, uint32_t within) {
     ProximityQuery *self = (ProximityQuery*)Class_Make_Obj(PROXIMITYQUERY);
     return ProximityQuery_init(self, field, terms, within);
 }
 
 ProximityQuery*
-ProximityQuery_init(ProximityQuery *self, String *field, VArray *terms,
+ProximityQuery_init(ProximityQuery *self, String *field, Vector *terms,
                     uint32_t within) {
-    return S_do_init(self, Str_Clone(field), VA_Clone(terms), 1.0f, within);
+    return S_do_init(self, Str_Clone(field), Vec_Clone(terms), 1.0f, within);
 }
 
 void
@@ -67,12 +67,12 @@ ProximityQuery_Destroy_IMP(ProximityQuery *self) {
 }
 
 static ProximityQuery*
-S_do_init(ProximityQuery *self, String *field, VArray *terms, float boost,
+S_do_init(ProximityQuery *self, String *field, Vector *terms, float boost,
           uint32_t within) {
     Query_init((Query*)self, boost);
     ProximityQueryIVARS *const ivars = ProximityQuery_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;
@@ -93,7 +93,7 @@ ProximityQuery*
 ProximityQuery_Deserialize_IMP(ProximityQuery *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);
     uint32_t within = InStream_Read_C32(instream);
     return S_do_init(self, field, terms, boost, within);
 }
@@ -121,7 +121,7 @@ ProximityQuery_Load_IMP(ProximityQuery *self, Obj *dump) {
     Obj *field = CERTIFY(Hash_Fetch_Utf8(source, "field", 5), OBJ);
     loaded_ivars->field = (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);
+    loaded_ivars->terms = (Vector*)CERTIFY(Freezer_load(terms), VECTOR);
     Obj *within = CERTIFY(Hash_Fetch_Utf8(source, "within", 6), OBJ);
     loaded_ivars->within = (uint32_t)Obj_To_I64(within);
     return (Obj*)loaded;
@@ -141,7 +141,7 @@ ProximityQuery_Equals_IMP(ProximityQuery *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; }
     if (ivars->within != ovars->within)               { return false; }
     return true;
 }
@@ -149,11 +149,11 @@ ProximityQuery_Equals_IMP(ProximityQuery *self, Obj *other) {
 String*
 ProximityQuery_To_String_IMP(ProximityQuery *self) {
     ProximityQueryIVARS *const ivars = ProximityQuery_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);
@@ -172,9 +172,9 @@ Compiler*
 ProximityQuery_Make_Compiler_IMP(ProximityQuery *self, Searcher *searcher,
                                  float boost, bool subordinate) {
     ProximityQueryIVARS *const ivars = ProximityQuery_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);
         TermQuery_Set_Boost(term_query, ivars->boost);
         TermCompiler *term_compiler
@@ -198,7 +198,7 @@ ProximityQuery_Get_Field_IMP(ProximityQuery *self) {
     return ProximityQuery_IVARS(self)->field;
 }
 
-VArray*
+Vector*
 ProximityQuery_Get_Terms_IMP(ProximityQuery *self) {
     return ProximityQuery_IVARS(self)->terms;
 }
@@ -225,7 +225,7 @@ ProximityCompiler_init(ProximityCompiler *self, ProximityQuery *parent,
     ProximityQueryIVARS *const parent_ivars = ProximityQuery_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;
 
     ivars->within = within;
 
@@ -237,8 +237,8 @@ ProximityCompiler_init(ProximityCompiler *self, ProximityQuery *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);
@@ -325,8 +325,8 @@ ProximityCompiler_Make_Matcher_IMP(ProximityCompiler *self, SegReader
*reader,
     UNUSED_VAR(need_score);
     ProximityQueryIVARS *const parent_ivars
         = ProximityQuery_IVARS((ProximityQuery*)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; }
@@ -347,9 +347,9 @@ ProximityCompiler_Make_Matcher_IMP(ProximityCompiler *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);
 
@@ -359,7 +359,7 @@ ProximityCompiler_Make_Matcher_IMP(ProximityCompiler *self, SegReader
*reader,
             DECREF(plists);
             return NULL;
         }
-        VA_Push(plists, (Obj*)plist);
+        Vec_Push(plists, (Obj*)plist);
     }
 
     Matcher *retval
@@ -368,27 +368,27 @@ ProximityCompiler_Make_Matcher_IMP(ProximityCompiler *self, SegReader
*reader,
     return retval;
 }
 
-VArray*
+Vector*
 ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler *self,
                                       Searcher *searcher, DocVector *doc_vec,
                                       String *field) {
     ProximityCompilerIVARS *const ivars = ProximityCompiler_IVARS(self);
     ProximityQueryIVARS *const parent_ivars
         = ProximityQuery_IVARS((ProximityQuery*)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);
 
@@ -397,7 +397,7 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler *self,
             break;
         }
 
-        VA_Push(term_vectors, (Obj*)term_vector);
+        Vec_Push(term_vectors, (Obj*)term_vector);
 
         if (i == 0) {
             // Set initial positions from first term.
@@ -422,11 +422,11 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler *self,
     }
 
     // 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);
@@ -457,7 +457,7 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler *self,
                 }
             }
 
-            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/LucyX/Search/ProximityQuery.cfh
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.cfh b/core/LucyX/Search/ProximityQuery.cfh
index f4e0584..b5cbd85 100644
--- a/core/LucyX/Search/ProximityQuery.cfh
+++ b/core/LucyX/Search/ProximityQuery.cfh
@@ -25,18 +25,18 @@ parcel Lucy;
 public class LucyX::Search::ProximityQuery inherits Lucy::Search::Query {
 
     String        *field;
-    VArray        *terms;
+    Vector        *terms;
     uint32_t       within;
 
     inert incremented ProximityQuery*
-    new(String *field, VArray *terms, uint32_t within);
+    new(String *field, Vector *terms, uint32_t within);
 
     /**
      * @param field The field that the phrase must occur in.
      * @param terms The ordered array of terms that must match.
      */
     public inert ProximityQuery*
-    init(ProximityQuery *self, String *field, VArray *terms, uint32_t within);
+    init(ProximityQuery *self, String *field, Vector *terms, uint32_t within);
 
     /** Accessor for object's field attribute.
      */
@@ -45,7 +45,7 @@ public class LucyX::Search::ProximityQuery inherits Lucy::Search::Query
{
 
     /** Accessor for object's array of terms.
      */
-    public VArray*
+    public Vector*
     Get_Terms(ProximityQuery *self);
 
     /** Accessor for object's within attribute.
@@ -107,7 +107,7 @@ class LucyX::Search::ProximityCompiler
     public void
     Apply_Norm_Factor(ProximityCompiler *self, float factor);
 
-    public incremented VArray*
+    public incremented Vector*
     Highlight_Spans(ProximityCompiler *self, Searcher *searcher,
                     DocVector *doc_vec, String *field);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/go/lucy/index.go
----------------------------------------------------------------------
diff --git a/go/lucy/index.go b/go/lucy/index.go
index a562e5a..78d2b48 100644
--- a/go/lucy/index.go
+++ b/go/lucy/index.go
@@ -23,7 +23,7 @@ package lucy
 #include "Lucy/Plan/Schema.h"
 #include "Clownfish/Hash.h"
 #include "Clownfish/String.h"
-#include "Clownfish/VArray.h"
+#include "Clownfish/Vector.h"
 #include "Clownfish/Err.h"
 */
 import "C"
@@ -163,8 +163,8 @@ func (obj *implIndexer) findFieldC(name string) *C.cfish_String {
 		schema := C.LUCY_Indexer_Get_Schema(obj.ref)
 		fieldList := C.LUCY_Schema_All_Fields(schema)
 		defer C.cfish_dec_refcount(unsafe.Pointer(fieldList))
-		for i := 0; i < int(C.CFISH_VA_Get_Size(fieldList)); i++ {
-			cfString := unsafe.Pointer(C.CFISH_VA_Fetch(fieldList, C.uint32_t(i)))
+		for i := 0; i < int(C.CFISH_Vec_Get_Size(fieldList)); i++ {
+			cfString := unsafe.Pointer(C.CFISH_Vec_Fetch(fieldList, C.uint32_t(i)))
 			field := clownfish.CFStringToGo(cfString)
 			if strings.EqualFold(name, field) {
 				C.cfish_inc_refcount(cfString)

http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/perl/t/213-segment_merging.t
----------------------------------------------------------------------
diff --git a/perl/t/213-segment_merging.t b/perl/t/213-segment_merging.t
index eabe5ba..900976e 100644
--- a/perl/t/213-segment_merging.t
+++ b/perl/t/213-segment_merging.t
@@ -23,7 +23,7 @@ package NonMergingIndexManager;
 use base qw( Lucy::Index::IndexManager );
 
 sub recycle {
-    return Clownfish::VArray->new;
+    return Clownfish::Vector->new;
 }
 
 # BiggerSchema is like TestSchema, but it has an extra field named "aux".

http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/perl/t/505-hit_queue.t
----------------------------------------------------------------------
diff --git a/perl/t/505-hit_queue.t b/perl/t/505-hit_queue.t
index 31acaa7..a57cc18 100644
--- a/perl/t/505-hit_queue.t
+++ b/perl/t/505-hit_queue.t
@@ -169,7 +169,7 @@ $hit_q = Lucy::Search::HitQueue->new(
 
 for my $doc_id ( shuffle( 1 .. 100 ) ) {
     my $fields = $docs[ $doc_id - 1 ];
-    my $values = Clownfish::VArray->new( capacity => 1 );
+    my $values = Clownfish::Vector->new( capacity => 1 );
     $values->push( Clownfish::String->new( $fields->{number} ) );
     my $match_doc = Lucy::Search::MatchDoc->new(
         doc_id => $doc_id,

http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/perl/t/518-or_scorer.t
----------------------------------------------------------------------
diff --git a/perl/t/518-or_scorer.t b/perl/t/518-or_scorer.t
index f5f09ed..d374217 100644
--- a/perl/t/518-or_scorer.t
+++ b/perl/t/518-or_scorer.t
@@ -38,7 +38,7 @@ sub check_matcher {
     my @intervals = @_;
     my @doc_id_arrays = map { modulo_set( $_, 100 ) } @intervals;
     my $child_matchers
-        = Clownfish::VArray->new( capacity => scalar @intervals );
+        = Clownfish::Vector->new( capacity => scalar @intervals );
     for my $doc_id_array (@doc_id_arrays) {
         if (@$doc_id_array) {
             my $mock = LucyX::Search::MockMatcher->new(

http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/perl/t/520-match_doc.t
----------------------------------------------------------------------
diff --git a/perl/t/520-match_doc.t b/perl/t/520-match_doc.t
index 0a864a5..05b2081 100644
--- a/perl/t/520-match_doc.t
+++ b/perl/t/520-match_doc.t
@@ -36,7 +36,7 @@ is( $match_doc_copy->get_score, $match_doc->get_score,
 is( $match_doc_copy->get_values, $match_doc->get_values,
     "empty values still empty after serialization" );
 
-my $values = Clownfish::VArray->new( capacity => 4 );
+my $values = Clownfish::Vector->new( capacity => 4 );
 $values->store( 0, Clownfish::String->new("foo") );
 $values->store( 3, Clownfish::String->new("bar") );
 $match_doc = Lucy::Search::MatchDoc->new(

http://git-wip-us.apache.org/repos/asf/lucy/blob/0c238b13/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index ab63e4c..264548e 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -69,10 +69,10 @@ S_fetch_entry(pTHX_ lucy_Inverter *self, HE *hash_entry) {
     }
 
     lucy_InverterEntry *entry
-        = (lucy_InverterEntry*)CFISH_VA_Fetch(ivars->entry_pool, field_num);
+        = (lucy_InverterEntry*)CFISH_Vec_Fetch(ivars->entry_pool, field_num);
     if (!entry) {
         entry = lucy_InvEntry_new(schema, (cfish_String*)field, field_num);
-        CFISH_VA_Store(ivars->entry_pool, field_num, (cfish_Obj*)entry);
+        CFISH_Vec_Store(ivars->entry_pool, field_num, (cfish_Obj*)entry);
     }
     return entry;
 }


Mime
View raw message