You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/05/02 01:50:38 UTC

[lucy-commits] svn commit: r1098445 [12/23] - in /incubator/lucy/trunk: charmonizer/ charmonizer/src/Charmonizer/ charmonizer/src/Charmonizer/Core/ charmonizer/src/Charmonizer/Probe/ charmonizer/src/Charmonizer/Test/ clownfish/lib/ clownfish/lib/Clownfish/Binding/ cl...

Modified: incubator/lucy/trunk/core/Lucy/Plan/Schema.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Plan/Schema.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Plan/Schema.c (original)
+++ incubator/lucy/trunk/core/Lucy/Plan/Schema.c Sun May  1 23:50:24 2011
@@ -46,15 +46,13 @@ static void
 S_add_numeric_field(Schema *self, const CharBuf *field, FieldType *type);
 
 Schema*
-Schema_new()
-{
+Schema_new() {
     Schema *self = (Schema*)VTable_Make_Obj(SCHEMA);
     return Schema_init(self);
 }
 
 Schema*
-Schema_init(Schema *self)
-{
+Schema_init(Schema *self) {
     // Init.
     self->analyzers      = Hash_new(0);
     self->types          = Hash_new(0);
@@ -70,8 +68,7 @@ Schema_init(Schema *self)
 }
 
 void
-Schema_destroy(Schema *self) 
-{
+Schema_destroy(Schema *self) {
     DECREF(self->arch);
     DECREF(self->analyzers);
     DECREF(self->uniq_analyzers);
@@ -82,8 +79,7 @@ Schema_destroy(Schema *self) 
 }
 
 static void
-S_add_unique(VArray *array, Obj *elem)
-{
+S_add_unique(VArray *array, Obj *elem) {
     uint32_t i, max;
     if (!elem) { return; }
     for (i = 0, max = VA_Get_Size(array); i < max; i++) {
@@ -98,8 +94,7 @@ S_add_unique(VArray *array, Obj *elem)
 }
 
 bool_t
-Schema_equals(Schema *self, Obj *other)
-{
+Schema_equals(Schema *self, Obj *other) {
     Schema *twin = (Schema*)other;
     if (twin == self) return true;
     if (!Obj_Is_A(other, SCHEMA)) return false;
@@ -110,15 +105,13 @@ Schema_equals(Schema *self, Obj *other)
 }
 
 Architecture*
-Schema_architecture(Schema *self)
-{
+Schema_architecture(Schema *self) {
     UNUSED_VAR(self);
     return Arch_new();
 }
 
 void
-Schema_spec_field(Schema *self, const CharBuf *field, FieldType *type)
-{
+Schema_spec_field(Schema *self, const CharBuf *field, FieldType *type) {
     FieldType *existing  = Schema_Fetch_Type(self, field);
 
     // If the field already has an association, verify pairing and return.
@@ -145,8 +138,7 @@ Schema_spec_field(Schema *self, const Ch
 }
 
 static void
-S_add_text_field(Schema *self, const CharBuf *field, FieldType *type)
-{
+S_add_text_field(Schema *self, const CharBuf *field, FieldType *type) {
     FullTextType *fttype    = (FullTextType*)CERTIFY(type, FULLTEXTTYPE);
     Similarity   *sim       = FullTextType_Make_Similarity(fttype);
     Analyzer     *analyzer  = FullTextType_Get_Analyzer(fttype);
@@ -161,8 +153,7 @@ S_add_text_field(Schema *self, const Cha
 }
 
 static void
-S_add_string_field(Schema *self, const CharBuf *field, FieldType *type)
-{
+S_add_string_field(Schema *self, const CharBuf *field, FieldType *type) {
     StringType *string_type = (StringType*)CERTIFY(type, STRINGTYPE);
     Similarity *sim         = StringType_Make_Similarity(string_type);
 
@@ -174,63 +165,60 @@ S_add_string_field(Schema *self, const C
 }
 
 static void
-S_add_blob_field(Schema *self, const CharBuf *field, FieldType *type)
-{
+S_add_blob_field(Schema *self, const CharBuf *field, FieldType *type) {
     BlobType *blob_type = (BlobType*)CERTIFY(type, BLOBTYPE);
     Hash_Store(self->types, (Obj*)field, INCREF(blob_type));
 }
 
 static void
-S_add_numeric_field(Schema *self, const CharBuf *field, FieldType *type)
-{
+S_add_numeric_field(Schema *self, const CharBuf *field, FieldType *type) {
     NumericType *num_type = (NumericType*)CERTIFY(type, NUMERICTYPE);
     Hash_Store(self->types, (Obj*)field, INCREF(num_type));
 }
 
 FieldType*
-Schema_fetch_type(Schema *self, const CharBuf *field)
-{
+Schema_fetch_type(Schema *self, const CharBuf *field) {
     return (FieldType*)Hash_Fetch(self->types, (Obj*)field);
 }
 
 Analyzer*
-Schema_fetch_analyzer(Schema *self, const CharBuf *field)
-{
+Schema_fetch_analyzer(Schema *self, const CharBuf *field) {
     return field
-        ? (Analyzer*)Hash_Fetch(self->analyzers, (Obj*)field)
-        : NULL;
+           ? (Analyzer*)Hash_Fetch(self->analyzers, (Obj*)field)
+           : NULL;
 }
 
 Similarity*
-Schema_fetch_sim(Schema *self, const CharBuf *field)
-{
+Schema_fetch_sim(Schema *self, const CharBuf *field) {
     Similarity *sim = NULL;
     if (field != NULL) {
         sim = (Similarity*)Hash_Fetch(self->sims, (Obj*)field);
-    }        
+    }
     return sim;
 }
 
 uint32_t
-Schema_num_fields(Schema *self)
-{
+Schema_num_fields(Schema *self) {
     return Hash_Get_Size(self->types);
 }
 
 Architecture*
-Schema_get_architecture(Schema *self) { return self->arch; }
+Schema_get_architecture(Schema *self) {
+    return self->arch;
+}
+
 Similarity*
-Schema_get_similarity(Schema *self)   { return self->sim; }
+Schema_get_similarity(Schema *self) {
+    return self->sim;
+}
 
 VArray*
-Schema_all_fields(Schema *self)
-{
+Schema_all_fields(Schema *self) {
     return Hash_Keys(self->types);
 }
 
 uint32_t
-S_find_in_array(VArray *array, Obj *obj)
-{
+S_find_in_array(VArray *array, Obj *obj) {
     uint32_t i, max;
     for (i = 0, max = VA_Get_Size(array); i < max; i++) {
         Obj *candidate = VA_Fetch(array, i);
@@ -255,8 +243,7 @@ static VTable *old_blob_type_vtable = NU
 
 //
 static void
-S_lazy_init_old_type_vtables(void) 
-{
+S_lazy_init_old_type_vtables(void) {
     if (old_full_text_type_vtable) { return; }
     CharBuf *klass = CB_new(40);
     CB_setf(klass, "Lucy::FieldType::FullTextType");
@@ -269,8 +256,7 @@ S_lazy_init_old_type_vtables(void) 
 }
 
 Hash*
-Schema_dump(Schema *self)
-{
+Schema_dump(Schema *self) {
     Hash *dump = Hash_new(0);
     Hash *type_dumps = Hash_new(Hash_Get_Size(self->types));
     CharBuf *field;
@@ -279,8 +265,8 @@ Schema_dump(Schema *self)
     S_lazy_init_old_type_vtables();
 
     // Record class name, store dumps of unique Analyzers.
-    Hash_Store_Str(dump, "_class", 6, 
-        (Obj*)CB_Clone(Schema_Get_Class_Name(self)));
+    Hash_Store_Str(dump, "_class", 6,
+                   (Obj*)CB_Clone(Schema_Get_Class_Name(self)));
     Hash_Store_Str(dump, "analyzers", 9, (Obj*)VA_Dump(self->uniq_analyzers));
 
     // Dump FieldTypes.
@@ -290,26 +276,26 @@ Schema_dump(Schema *self)
         VTable *type_vtable = FType_Get_VTable(type);
 
         // Dump known types to simplified format.
-        if (   type_vtable == FULLTEXTTYPE
+        if (type_vtable == FULLTEXTTYPE
             || type_vtable == old_full_text_type_vtable
-        ) {
+           ) {
             FullTextType *fttype = (FullTextType*)type;
             Hash *type_dump = FullTextType_Dump_For_Schema(fttype);
             Analyzer *analyzer = FullTextType_Get_Analyzer(fttype);
-            uint32_t tick 
+            uint32_t tick
                 = S_find_in_array(self->uniq_analyzers, (Obj*)analyzer);
 
             // Store the tick which references a unique analyzer.
-            Hash_Store_Str(type_dump, "analyzer", 8, 
-                (Obj*)CB_newf("%u32", tick));
+            Hash_Store_Str(type_dump, "analyzer", 8,
+                           (Obj*)CB_newf("%u32", tick));
 
             Hash_Store(type_dumps, (Obj*)field, (Obj*)type_dump);
         }
-        else if (   type_vtable == STRINGTYPE
+        else if (type_vtable == STRINGTYPE
                  || type_vtable == old_string_type_vtable
                  || type_vtable == BLOBTYPE
                  || type_vtable == old_blob_type_vtable
-        ) {
+                ) {
             Hash *type_dump = FType_Dump_For_Schema(type);
             Hash_Store(type_dumps, (Obj*)field, (Obj*)type_dump);
         }
@@ -323,18 +309,17 @@ Schema_dump(Schema *self)
 }
 
 Schema*
-Schema_load(Schema *self, Obj *dump)
-{
+Schema_load(Schema *self, Obj *dump) {
     Hash *source = (Hash*)CERTIFY(dump, HASH);
-    CharBuf *class_name = (CharBuf*)CERTIFY(
-        Hash_Fetch_Str(source, "_class", 6), CHARBUF);
+    CharBuf *class_name
+        = (CharBuf*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), CHARBUF);
     VTable *vtable = VTable_singleton(class_name, NULL);
     Schema *loaded = (Schema*)VTable_Make_Obj(vtable);
-    Hash *type_dumps = (Hash*)CERTIFY(
-        Hash_Fetch_Str(source, "fields", 6), HASH);
-    VArray *analyzer_dumps = (VArray*)CERTIFY(
-        Hash_Fetch_Str(source, "analyzers", 9), VARRAY);
-    VArray *analyzers 
+    Hash *type_dumps
+        = (Hash*)CERTIFY(Hash_Fetch_Str(source, "fields", 6), HASH);
+    VArray *analyzer_dumps
+        = (VArray*)CERTIFY(Hash_Fetch_Str(source, "analyzers", 9), VARRAY);
+    VArray *analyzers
         = (VArray*)VA_Load(analyzer_dumps, (Obj*)analyzer_dumps);
     CharBuf *field;
     Hash    *type_dump;
@@ -352,62 +337,68 @@ Schema_load(Schema *self, Obj *dump)
         if (type_str) {
             if (CB_Equals_Str(type_str, "fulltext", 8)) {
                 // Replace the "analyzer" tick with the real thing.
-                Obj *tick = CERTIFY(
-                    Hash_Fetch_Str(type_dump, "analyzer", 8), OBJ);
-                Analyzer *analyzer = (Analyzer*)VA_Fetch(analyzers, 
-                    (uint32_t)Obj_To_I64(tick));
-                if (!analyzer) { 
+                Obj *tick
+                    = CERTIFY(Hash_Fetch_Str(type_dump, "analyzer", 8), OBJ);
+                Analyzer *analyzer
+                    = (Analyzer*)VA_Fetch(analyzers,
+                                          (uint32_t)Obj_To_I64(tick));
+                if (!analyzer) {
                     THROW(ERR, "Can't find analyzer for '%o'", field);
                 }
                 Hash_Store_Str(type_dump, "analyzer", 8, INCREF(analyzer));
-                FullTextType *type = (FullTextType*)VTable_Load_Obj(
-                    FULLTEXTTYPE, (Obj*)type_dump);
+                FullTextType *type
+                    = (FullTextType*)VTable_Load_Obj(FULLTEXTTYPE,
+                                                     (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
             else if (CB_Equals_Str(type_str, "string", 6)) {
-                StringType *type = (StringType*)VTable_Load_Obj(
-                    STRINGTYPE, (Obj*)type_dump);
+                StringType *type
+                    = (StringType*)VTable_Load_Obj(STRINGTYPE,
+                                                   (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
             else if (CB_Equals_Str(type_str, "blob", 4)) {
-                BlobType *type = (BlobType*)VTable_Load_Obj(
-                    BLOBTYPE, (Obj*)type_dump);
+                BlobType *type
+                    = (BlobType*)VTable_Load_Obj(BLOBTYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
             else if (CB_Equals_Str(type_str, "i32_t", 5)) {
-                Int32Type *type = (Int32Type*)VTable_Load_Obj(
-                    INT32TYPE, (Obj*)type_dump);
+                Int32Type *type
+                    = (Int32Type*)VTable_Load_Obj(INT32TYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
             else if (CB_Equals_Str(type_str, "i64_t", 5)) {
-                Int64Type *type = (Int64Type*)VTable_Load_Obj(
-                    INT64TYPE, (Obj*)type_dump);
+                Int64Type *type
+                    = (Int64Type*)VTable_Load_Obj(INT64TYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
             else if (CB_Equals_Str(type_str, "f32_t", 5)) {
-                Float32Type *type = (Float32Type*)VTable_Load_Obj(
-                    FLOAT32TYPE, (Obj*)type_dump);
+                Float32Type *type
+                    = (Float32Type*)VTable_Load_Obj(FLOAT32TYPE,
+                                                    (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
             else if (CB_Equals_Str(type_str, "f64_t", 5)) {
-                Float64Type *type = (Float64Type*)VTable_Load_Obj(
-                    FLOAT64TYPE, (Obj*)type_dump);
+                Float64Type *type
+                    = (Float64Type*)VTable_Load_Obj(FLOAT64TYPE,
+                                                    (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
             else {
                 THROW(ERR, "Unknown type '%o' for field '%o'", type_str, field);
             }
-         }
+        }
         else {
             FieldType *type = (FieldType*)CERTIFY(
-                Hash_Load(type_dump, (Obj*)type_dump), FIELDTYPE);
+                                  Hash_Load(type_dump, (Obj*)type_dump),
+                                  FIELDTYPE);
             Schema_Spec_Field(loaded, field, type);
             DECREF(type);
         }
@@ -419,19 +410,18 @@ Schema_load(Schema *self, Obj *dump)
 }
 
 void
-Schema_eat(Schema *self, Schema *other)
-{
+Schema_eat(Schema *self, Schema *other) {
     if (!Schema_Is_A(self, Schema_Get_VTable(other))) {
         // Special case because of move of Lucy::Schema.
-        if (   Schema_Get_VTable(self) == SCHEMA 
+        if (Schema_Get_VTable(self) == SCHEMA
             && CB_Equals_Str(Schema_Get_Class_Name(other),
-                "Lucy::Schema", 12)
-        ) {
+                             "Lucy::Schema", 12)
+           ) {
             // allow
         }
         else {
-            THROW(ERR, "%o not a descendent of %o", 
-                Schema_Get_Class_Name(self), Schema_Get_Class_Name(other));
+            THROW(ERR, "%o not a descendent of %o",
+                  Schema_Get_Class_Name(self), Schema_Get_Class_Name(other));
         }
     }
 
@@ -444,8 +434,7 @@ Schema_eat(Schema *self, Schema *other)
 }
 
 void
-Schema_write(Schema *self, Folder *folder, const CharBuf *filename)
-{
+Schema_write(Schema *self, Folder *folder, const CharBuf *filename) {
     Hash *dump = Schema_Dump(self);
     ZombieCharBuf *schema_temp = ZCB_WRAP_STR("schema.temp", 11);
     bool_t success;

Modified: incubator/lucy/trunk/core/Lucy/Plan/Schema.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Plan/Schema.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Plan/Schema.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Plan/Schema.cfh Sun May  1 23:50:24 2011
@@ -88,12 +88,12 @@ class Lucy::Plan::Schema inherits Lucy::
 
     /** Return the Schema instance's internal Architecture object.
      */
-    public Architecture* 
+    public Architecture*
     Get_Architecture(Schema *self);
 
     /** Return the Schema instance's internal Similarity object.
      */
-    public Similarity* 
+    public Similarity*
     Get_Similarity(Schema *self);
 
     public incremented Hash*
@@ -101,7 +101,7 @@ class Lucy::Plan::Schema inherits Lucy::
 
     public incremented Schema*
     Load(Schema *self, Obj *dump);
-    
+
     /** Absorb the field definitions of another Schema, verify compatibility.
      */
     void

Modified: incubator/lucy/trunk/core/Lucy/Plan/StringType.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Plan/StringType.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Plan/StringType.c (original)
+++ incubator/lucy/trunk/core/Lucy/Plan/StringType.c Sun May  1 23:50:24 2011
@@ -22,22 +22,19 @@
 #include "Lucy/Index/Similarity.h"
 
 StringType*
-StringType_new()
-{
+StringType_new() {
     StringType *self = (StringType*)VTable_Make_Obj(STRINGTYPE);
     return StringType_init(self);
 }
 
 StringType*
-StringType_init(StringType *self)
-{
+StringType_init(StringType *self) {
     return StringType_init2(self, 1.0, true, true, false);
 }
 
 StringType*
-StringType_init2(StringType *self, float boost, bool_t indexed, 
-                 bool_t stored, bool_t sortable)
-{
+StringType_init2(StringType *self, float boost, bool_t indexed,
+                 bool_t stored, bool_t sortable) {
     FType_init((FieldType*)self);
     self->boost      = boost;
     self->indexed    = indexed;
@@ -47,8 +44,7 @@ StringType_init2(StringType *self, float
 }
 
 bool_t
-StringType_equals(StringType *self, Obj *other)
-{
+StringType_equals(StringType *self, Obj *other) {
     StringType *twin = (StringType*)other;
     if (twin == self) return true;
     if (!FType_equals((FieldType*)self, other)) return false;
@@ -56,8 +52,7 @@ StringType_equals(StringType *self, Obj 
 }
 
 Hash*
-StringType_dump_for_schema(StringType *self) 
-{
+StringType_dump_for_schema(StringType *self) {
     Hash *dump = Hash_new(0);
     Hash_Store_Str(dump, "type", 4, (Obj*)CB_newf("string"));
 
@@ -79,24 +74,22 @@ StringType_dump_for_schema(StringType *s
 }
 
 Hash*
-StringType_dump(StringType *self)
-{
+StringType_dump(StringType *self) {
     Hash *dump = StringType_Dump_For_Schema(self);
-    Hash_Store_Str(dump, "_class", 6, 
-        (Obj*)CB_Clone(StringType_Get_Class_Name(self)));
+    Hash_Store_Str(dump, "_class", 6,
+                   (Obj*)CB_Clone(StringType_Get_Class_Name(self)));
     DECREF(Hash_Delete_Str(dump, "type", 4));
     return dump;
 }
 
 StringType*
-StringType_load(StringType *self, Obj *dump)
-{
+StringType_load(StringType *self, Obj *dump) {
     Hash *source = (Hash*)CERTIFY(dump, HASH);
     CharBuf *class_name = (CharBuf*)Hash_Fetch_Str(source, "_class", 6);
-    VTable *vtable 
+    VTable *vtable
         = (class_name != NULL && Obj_Is_A((Obj*)class_name, CHARBUF))
-        ? VTable_singleton(class_name, NULL)
-        : STRINGTYPE;
+          ? VTable_singleton(class_name, NULL)
+          : STRINGTYPE;
     StringType *loaded   = (StringType*)VTable_Make_Obj(vtable);
     Obj *boost_dump      = Hash_Fetch_Str(source, "boost", 5);
     Obj *indexed_dump    = Hash_Fetch_Str(source, "indexed", 7);
@@ -105,28 +98,30 @@ StringType_load(StringType *self, Obj *d
     UNUSED_VAR(self);
 
     StringType_init(loaded);
-    if (boost_dump)    
-        { loaded->boost    = (float)Obj_To_F64(boost_dump);     }
-    if (indexed_dump)  
-        { loaded->indexed  = (bool_t)Obj_To_I64(indexed_dump);  }
-    if (stored_dump)   
-        { loaded->stored   = (bool_t)Obj_To_I64(stored_dump);   }
-    if (sortable_dump) 
-        { loaded->sortable = (bool_t)Obj_To_I64(sortable_dump); }
+    if (boost_dump) {
+        loaded->boost = (float)Obj_To_F64(boost_dump);
+    }
+    if (indexed_dump) {
+        loaded->indexed = (bool_t)Obj_To_I64(indexed_dump);
+    }
+    if (stored_dump) {
+        loaded->stored = (bool_t)Obj_To_I64(stored_dump);
+    }
+    if (sortable_dump) {
+        loaded->sortable = (bool_t)Obj_To_I64(sortable_dump);
+    }
 
     return loaded;
 }
 
 Similarity*
-StringType_make_similarity(StringType *self)
-{
+StringType_make_similarity(StringType *self) {
     UNUSED_VAR(self);
     return Sim_new();
 }
 
 Posting*
-StringType_make_posting(StringType *self, Similarity *similarity)
-{
+StringType_make_posting(StringType *self, Similarity *similarity) {
     if (similarity) {
         return (Posting*)ScorePost_new(similarity);
     }

Modified: incubator/lucy/trunk/core/Lucy/Plan/StringType.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Plan/StringType.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Plan/StringType.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Plan/StringType.cfh Sun May  1 23:50:24 2011
@@ -20,7 +20,7 @@ parcel Lucy;
  *
  * Lucy::Plan::StringType is used for "exact-match" strings.
  */
-class Lucy::Plan::StringType 
+class Lucy::Plan::StringType
     inherits Lucy::Plan::TextType : dumpable {
 
     /**
@@ -30,14 +30,14 @@ class Lucy::Plan::StringType 
      * @param sortable boolean indicating whether the field should be
      * sortable.
      */
-    public inert StringType* 
+    public inert StringType*
     init(StringType *self);
 
-    inert StringType* 
-    init2(StringType *self, float boost = 1.0, bool_t indexed = true, 
+    inert StringType*
+    init2(StringType *self, float boost = 1.0, bool_t indexed = true,
           bool_t stored = true, bool_t sortable = false);
 
-    public inert incremented StringType* 
+    public inert incremented StringType*
     new();
 
     public incremented Similarity*

Modified: incubator/lucy/trunk/core/Lucy/Plan/TextType.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Plan/TextType.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Plan/TextType.c (original)
+++ incubator/lucy/trunk/core/Lucy/Plan/TextType.c Sun May  1 23:50:24 2011
@@ -24,22 +24,19 @@
 #include "Lucy/Util/StringHelper.h"
 
 CharBuf*
-TextType_make_blank(TextType *self)
-{
+TextType_make_blank(TextType *self) {
     UNUSED_VAR(self);
     return CB_new(0);
 }
 
 TermStepper*
-TextType_make_term_stepper(TextType *self)
-{
+TextType_make_term_stepper(TextType *self) {
     UNUSED_VAR(self);
     return (TermStepper*)TextTermStepper_new();
 }
 
 int8_t
-TextType_primitive_id(TextType *self)
-{
+TextType_primitive_id(TextType *self) {
     UNUSED_VAR(self);
     return FType_TEXT;
 }
@@ -47,47 +44,41 @@ TextType_primitive_id(TextType *self)
 /***************************************************************************/
 
 TextTermStepper*
-TextTermStepper_new()
-{
-    TextTermStepper *self 
+TextTermStepper_new() {
+    TextTermStepper *self
         = (TextTermStepper*)VTable_Make_Obj(TEXTTERMSTEPPER);
     return TextTermStepper_init(self);
 }
 
 TextTermStepper*
-TextTermStepper_init(TextTermStepper *self)
-{
+TextTermStepper_init(TextTermStepper *self) {
     TermStepper_init((TermStepper*)self);
     self->value = (Obj*)CB_new(0);
     return self;
 }
 
 void
-TextTermStepper_set_value(TextTermStepper *self, Obj *value)
-{
+TextTermStepper_set_value(TextTermStepper *self, Obj *value) {
     CERTIFY(value, CHARBUF);
     DECREF(self->value);
     self->value = INCREF(value);
 }
 
 void
-TextTermStepper_reset(TextTermStepper *self)
-{
+TextTermStepper_reset(TextTermStepper *self) {
     CB_Set_Size((CharBuf*)self->value, 0);
 }
 
 void
 TextTermStepper_write_key_frame(TextTermStepper *self, OutStream *outstream,
-                                Obj *value)
-{
+                                Obj *value) {
     Obj_Serialize(value, outstream);
     Obj_Mimic(self->value, value);
 }
 
 void
 TextTermStepper_write_delta(TextTermStepper *self, OutStream *outstream,
-                            Obj *value)
-{
+                            Obj *value) {
     CharBuf *new_value  = (CharBuf*)CERTIFY(value, CHARBUF);
     CharBuf *last_value = (CharBuf*)self->value;
     char    *new_text  = (char*)CB_Get_Ptr8(new_value);
@@ -97,7 +88,7 @@ TextTermStepper_write_delta(TextTermStep
 
     // Count how many bytes the strings share at the top.
     const int32_t overlap = StrHelp_overlap(last_text, new_text,
-        last_size, new_size);
+                                            last_size, new_size);
     const char *const diff_start_str = new_text + overlap;
     const size_t diff_len            = new_size - overlap;
 
@@ -110,8 +101,7 @@ TextTermStepper_write_delta(TextTermStep
 }
 
 void
-TextTermStepper_read_key_frame(TextTermStepper *self, InStream *instream)
-{ 
+TextTermStepper_read_key_frame(TextTermStepper *self, InStream *instream) {
     const uint32_t text_len = InStream_Read_C32(instream);
     CharBuf *value;
     char *ptr;
@@ -128,8 +118,8 @@ TextTermStepper_read_key_frame(TextTermS
     CB_Set_Size(value, text_len);
     if (!StrHelp_utf8_valid(ptr, text_len)) {
         THROW(ERR, "Invalid UTF-8 sequence in '%o' at byte %i64",
-            InStream_Get_Filename(instream), 
-            InStream_Tell(instream) - text_len);
+              InStream_Get_Filename(instream),
+              InStream_Tell(instream) - text_len);
     }
 
     // Null-terminate.
@@ -137,8 +127,7 @@ TextTermStepper_read_key_frame(TextTermS
 }
 
 void
-TextTermStepper_read_delta(TextTermStepper *self, InStream *instream)
-{ 
+TextTermStepper_read_delta(TextTermStepper *self, InStream *instream) {
     const uint32_t text_overlap     = InStream_Read_C32(instream);
     const uint32_t finish_chars_len = InStream_Read_C32(instream);
     const uint32_t total_text_len   = text_overlap + finish_chars_len;
@@ -157,8 +146,8 @@ TextTermStepper_read_delta(TextTermStepp
     CB_Set_Size(value, total_text_len);
     if (!StrHelp_utf8_valid(ptr, total_text_len)) {
         THROW(ERR, "Invalid UTF-8 sequence in '%o' at byte %i64",
-            InStream_Get_Filename(instream), 
-            InStream_Tell(instream) - finish_chars_len);
+              InStream_Get_Filename(instream),
+              InStream_Tell(instream) - finish_chars_len);
     }
 
     // Null-terminate.

Modified: incubator/lucy/trunk/core/Lucy/Plan/TextType.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Plan/TextType.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Plan/TextType.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Plan/TextType.cfh Sun May  1 23:50:24 2011
@@ -16,7 +16,7 @@
 
 parcel Lucy;
 
-class Lucy::Plan::TextType inherits Lucy::Plan::FieldType { 
+class Lucy::Plan::TextType inherits Lucy::Plan::FieldType {
     incremented CharBuf*
     Make_Blank(TextType *self);
 
@@ -25,7 +25,7 @@ class Lucy::Plan::TextType inherits Lucy
 
     int8_t
     Primitive_ID(TextType *self);
-} 
+}
 
 class Lucy::Index::TermStepper::TextTermStepper
     inherits Lucy::Index::TermStepper {
@@ -36,7 +36,7 @@ class Lucy::Index::TermStepper::TextTerm
     inert TextTermStepper*
     init(TextTermStepper *self);
 
-    public void 
+    public void
     Reset(TextTermStepper *self);
 
     /**

Modified: incubator/lucy/trunk/core/Lucy/Search/ANDMatcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/ANDMatcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/ANDMatcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/ANDMatcher.c Sun May  1 23:50:24 2011
@@ -21,15 +21,13 @@
 #include "Lucy/Index/Similarity.h"
 
 ANDMatcher*
-ANDMatcher_new(VArray *children, Similarity *sim) 
-{
+ANDMatcher_new(VArray *children, Similarity *sim) {
     ANDMatcher *self = (ANDMatcher*)VTable_Make_Obj(ANDMATCHER);
     return ANDMatcher_init(self, children, sim);
 }
 
 ANDMatcher*
-ANDMatcher_init(ANDMatcher *self, VArray *children, Similarity *sim) 
-{
+ANDMatcher_init(ANDMatcher *self, VArray *children, Similarity *sim) {
     uint32_t i;
 
     // Init.
@@ -52,15 +50,13 @@ ANDMatcher_init(ANDMatcher *self, VArray
 }
 
 void
-ANDMatcher_destroy(ANDMatcher *self) 
-{
+ANDMatcher_destroy(ANDMatcher *self) {
     FREEMEM(self->kids);
     SUPER_DESTROY(self, ANDMATCHER);
 }
 
 int32_t
-ANDMatcher_next(ANDMatcher *self)
-{
+ANDMatcher_next(ANDMatcher *self) {
     if (self->first_time) {
         return ANDMatcher_Advance(self, 1);
     }
@@ -74,11 +70,10 @@ ANDMatcher_next(ANDMatcher *self)
 }
 
 int32_t
-ANDMatcher_advance(ANDMatcher *self, int32_t target)
-{
-    Matcher **const kids = self->kids;
-    const uint32_t  num_kids   = self->num_kids;
-    int32_t         highest    = 0;
+ANDMatcher_advance(ANDMatcher *self, int32_t target) {
+    Matcher **const kids     = self->kids;
+    const uint32_t  num_kids = self->num_kids;
+    int32_t         highest  = 0;
 
     if (!self->more) return 0;
 
@@ -88,14 +83,14 @@ ANDMatcher_advance(ANDMatcher *self, int
     }
     else {
         highest = Matcher_Advance(kids[0], target);
-        if (!highest) { 
+        if (!highest) {
             self->more = false;
             return 0;
         }
     }
 
     // Second step: reconcile.
-    while(1) {
+    while (1) {
         uint32_t i;
         bool_t agreement = true;
 
@@ -141,20 +136,18 @@ ANDMatcher_advance(ANDMatcher *self, int
         if (highest >= target) {
             break;
         }
-    } 
+    }
 
     return highest;
 }
 
 int32_t
-ANDMatcher_get_doc_id(ANDMatcher *self)
-{
+ANDMatcher_get_doc_id(ANDMatcher *self) {
     return Matcher_Get_Doc_ID(self->kids[0]);
 }
 
 float
-ANDMatcher_score(ANDMatcher *self)
-{
+ANDMatcher_score(ANDMatcher *self) {
     uint32_t i;
     Matcher **const kids = self->kids;
     float score = 0.0f;
@@ -163,7 +156,7 @@ ANDMatcher_score(ANDMatcher *self)
         score += Matcher_Score(kids[i]);
     }
 
-    score *= self->coord_factors[ self->matching_kids ];
+    score *= self->coord_factors[self->matching_kids];
 
     return score;
 }

Modified: incubator/lucy/trunk/core/Lucy/Search/ANDMatcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/ANDMatcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/ANDMatcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/ANDMatcher.cfh Sun May  1 23:50:24 2011
@@ -25,10 +25,10 @@ class Lucy::Search::ANDMatcher inherits 
     bool_t        more;
     bool_t        first_time;
 
-    inert incremented ANDMatcher* 
+    inert incremented ANDMatcher*
     new(VArray *children, Similarity *sim);
 
-    inert ANDMatcher* 
+    inert ANDMatcher*
     init(ANDMatcher *self, VArray *children, Similarity *similarity);
 
     public void
@@ -43,7 +43,7 @@ class Lucy::Search::ANDMatcher inherits 
     public float
     Score(ANDMatcher *self);
 
-    public int32_t 
+    public int32_t
     Get_Doc_ID(ANDMatcher *self);
 }
 

Modified: incubator/lucy/trunk/core/Lucy/Search/ANDQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/ANDQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/ANDQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/ANDQuery.c Sun May  1 23:50:24 2011
@@ -31,21 +31,18 @@
 #include "Lucy/Util/Freezer.h"
 
 ANDQuery*
-ANDQuery_new(VArray *children)
-{
+ANDQuery_new(VArray *children) {
     ANDQuery *self = (ANDQuery*)VTable_Make_Obj(ANDQUERY);
     return ANDQuery_init(self, children);
 }
 
 ANDQuery*
-ANDQuery_init(ANDQuery *self, VArray *children)
-{
+ANDQuery_init(ANDQuery *self, VArray *children) {
     return (ANDQuery*)PolyQuery_init((PolyQuery*)self, children);
 }
 
 CharBuf*
-ANDQuery_to_string(ANDQuery *self)
-{
+ANDQuery_to_string(ANDQuery *self) {
     uint32_t num_kids = VA_Get_Size(self->children);
     if (!num_kids) return CB_new_from_trusted_utf8("()", 2);
     else {
@@ -68,42 +65,37 @@ ANDQuery_to_string(ANDQuery *self)
 
 
 bool_t
-ANDQuery_equals(ANDQuery *self, Obj *other)
-{
+ANDQuery_equals(ANDQuery *self, Obj *other) {
     if ((ANDQuery*)other == self) return true;
     if (!Obj_Is_A(other, ANDQUERY)) { return false; }
     return PolyQuery_equals((PolyQuery*)self, other);
 }
 
 Compiler*
-ANDQuery_make_compiler(ANDQuery *self, Searcher *searcher, float boost)
-{
+ANDQuery_make_compiler(ANDQuery *self, Searcher *searcher, float boost) {
     return (Compiler*)ANDCompiler_new(self, searcher, boost);
 }
 
 /**********************************************************************/
 
 ANDCompiler*
-ANDCompiler_new(ANDQuery *parent, Searcher *searcher, float boost)
-{
+ANDCompiler_new(ANDQuery *parent, Searcher *searcher, float boost) {
     ANDCompiler *self = (ANDCompiler*)VTable_Make_Obj(ANDCOMPILER);
     return ANDCompiler_init(self, parent, searcher, boost);
 }
 
 ANDCompiler*
-ANDCompiler_init(ANDCompiler *self, ANDQuery *parent, Searcher *searcher, 
-                 float boost)
-{
-    PolyCompiler_init((PolyCompiler*)self, (PolyQuery*)parent, searcher, 
-        boost);
+ANDCompiler_init(ANDCompiler *self, ANDQuery *parent, Searcher *searcher,
+                 float boost) {
+    PolyCompiler_init((PolyCompiler*)self, (PolyQuery*)parent, searcher,
+                      boost);
     ANDCompiler_Normalize(self);
     return self;
 }
 
 Matcher*
-ANDCompiler_make_matcher(ANDCompiler *self, SegReader *reader, 
-                         bool_t need_score)
-{
+ANDCompiler_make_matcher(ANDCompiler *self, SegReader *reader,
+                         bool_t need_score) {
     uint32_t num_kids = VA_Get_Size(self->children);
 
     if (num_kids == 1) {
@@ -117,7 +109,7 @@ ANDCompiler_make_matcher(ANDCompiler *se
         // Add child matchers one by one.
         for (i = 0; i < num_kids; i++) {
             Compiler *child = (Compiler*)VA_Fetch(self->children, i);
-            Matcher *child_matcher 
+            Matcher *child_matcher
                 = Compiler_Make_Matcher(child, reader, need_score);
 
             // If any required clause fails, the whole thing fails.
@@ -130,9 +122,10 @@ ANDCompiler_make_matcher(ANDCompiler *se
             }
         }
 
-        { 
-            Matcher *retval = (Matcher*)ANDMatcher_new(child_matchers, 
-                ANDCompiler_Get_Similarity(self));
+        {
+            Matcher *retval
+                = (Matcher*)ANDMatcher_new(child_matchers,
+                                           ANDCompiler_Get_Similarity(self));
             DECREF(child_matchers);
             return retval;
         }

Modified: incubator/lucy/trunk/core/Lucy/Search/ANDQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/ANDQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/ANDQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/ANDQuery.cfh Sun May  1 23:50:24 2011
@@ -22,7 +22,7 @@ parcel Lucy;
  * only when all of its children match, so its result set is the intersection
  * of their result sets.  Documents which match receive a summed score.
  */
-class Lucy::Search::ANDQuery inherits Lucy::Search::PolyQuery 
+class Lucy::Search::ANDQuery inherits Lucy::Search::PolyQuery
     : dumpable {
 
     inert incremented ANDQuery*
@@ -44,14 +44,14 @@ class Lucy::Search::ANDQuery inherits Lu
     Equals(ANDQuery *self, Obj *other);
 }
 
-class Lucy::Search::ANDCompiler 
+class Lucy::Search::ANDCompiler
     inherits Lucy::Search::PolyCompiler {
 
     inert incremented ANDCompiler*
     new(ANDQuery *parent, Searcher *searcher, float boost);
 
     inert ANDCompiler*
-    init(ANDCompiler *self, ANDQuery *parent, Searcher *searcher, 
+    init(ANDCompiler *self, ANDQuery *parent, Searcher *searcher,
          float boost);
 
     public incremented nullable Matcher*

Modified: incubator/lucy/trunk/core/Lucy/Search/BitVecMatcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/BitVecMatcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/BitVecMatcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/BitVecMatcher.c Sun May  1 23:50:24 2011
@@ -20,15 +20,13 @@
 #include "Lucy/Search/BitVecMatcher.h"
 
 BitVecMatcher*
-BitVecMatcher_new(BitVector *bit_vector)
-{
+BitVecMatcher_new(BitVector *bit_vector) {
     BitVecMatcher *self = (BitVecMatcher*)VTable_Make_Obj(BITVECMATCHER);
     return BitVecMatcher_init(self, bit_vector);
 }
 
 BitVecMatcher*
-BitVecMatcher_init(BitVecMatcher *self, BitVector *bit_vector)
-{
+BitVecMatcher_init(BitVecMatcher *self, BitVector *bit_vector) {
     Matcher_init((Matcher*)self);
     self->bit_vec = (BitVector*)INCREF(bit_vector);
     self->doc_id = 0;
@@ -36,27 +34,26 @@ BitVecMatcher_init(BitVecMatcher *self, 
 }
 
 void
-BitVecMatcher_destroy(BitVecMatcher *self)
-{
+BitVecMatcher_destroy(BitVecMatcher *self) {
     DECREF(self->bit_vec);
     SUPER_DESTROY(self, BITVECMATCHER);
 }
 
 int32_t
-BitVecMatcher_next(BitVecMatcher *self)
-{
+BitVecMatcher_next(BitVecMatcher *self) {
     self->doc_id = BitVec_Next_Hit(self->bit_vec, self->doc_id + 1);
     return self->doc_id == -1 ? 0 : self->doc_id;
 }
 
 int32_t
-BitVecMatcher_advance(BitVecMatcher *self, int32_t target) 
-{
+BitVecMatcher_advance(BitVecMatcher *self, int32_t target) {
     self->doc_id = BitVec_Next_Hit(self->bit_vec, target);
     return self->doc_id == -1 ? 0 : self->doc_id;
 }
 
 int32_t
-BitVecMatcher_get_doc_id(BitVecMatcher *self) { return self->doc_id; }
+BitVecMatcher_get_doc_id(BitVecMatcher *self) {
+    return self->doc_id;
+}
 
 

Modified: incubator/lucy/trunk/core/Lucy/Search/Collector.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Collector.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Collector.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Collector.c Sun May  1 23:50:24 2011
@@ -24,8 +24,7 @@
 #include "Lucy/Search/Matcher.h"
 
 Collector*
-Coll_init(Collector *self)
-{
+Coll_init(Collector *self) {
     ABSTRACT_CLASS_CHECK(self, COLLECTOR);
     self->reader  = NULL;
     self->matcher = NULL;
@@ -34,80 +33,69 @@ Coll_init(Collector *self)
 }
 
 void
-Coll_destroy(Collector *self)
-{
+Coll_destroy(Collector *self) {
     DECREF(self->reader);
     DECREF(self->matcher);
     SUPER_DESTROY(self, COLLECTOR);
 }
 
 void
-Coll_set_reader(Collector *self, SegReader *reader)
-{
+Coll_set_reader(Collector *self, SegReader *reader) {
     DECREF(self->reader);
     self->reader = (SegReader*)INCREF(reader);
 }
 
 void
-Coll_set_matcher(Collector *self, Matcher *matcher)
-{
+Coll_set_matcher(Collector *self, Matcher *matcher) {
     DECREF(self->matcher);
     self->matcher = (Matcher*)INCREF(matcher);
 }
 
 void
-Coll_set_base(Collector *self, int32_t base)
-{
+Coll_set_base(Collector *self, int32_t base) {
     self->base = base;
 }
 
 BitCollector*
-BitColl_new(BitVector *bit_vec) 
-{
+BitColl_new(BitVector *bit_vec) {
     BitCollector *self = (BitCollector*)VTable_Make_Obj(BITCOLLECTOR);
     return BitColl_init(self, bit_vec);
 }
 
 BitCollector*
-BitColl_init(BitCollector *self, BitVector *bit_vec) 
-{
+BitColl_init(BitCollector *self, BitVector *bit_vec) {
     Coll_init((Collector*)self);
     self->bit_vec = (BitVector*)INCREF(bit_vec);
     return self;
 }
 
 void
-BitColl_destroy(BitCollector *self)
-{
+BitColl_destroy(BitCollector *self) {
     DECREF(self->bit_vec);
     SUPER_DESTROY(self, BITCOLLECTOR);
 }
 
 void
-BitColl_collect(BitCollector *self, int32_t doc_id) 
-{
+BitColl_collect(BitCollector *self, int32_t doc_id) {
     // Add the doc_id to the BitVector.
     BitVec_Set(self->bit_vec, (self->base + doc_id));
 }
 
 bool_t
-BitColl_need_score(BitCollector *self) 
-{
+BitColl_need_score(BitCollector *self) {
     UNUSED_VAR(self);
     return false;
 }
 
 OffsetCollector*
-OffsetColl_new(Collector *inner_coll, int32_t offset) 
-{
-    OffsetCollector *self 
+OffsetColl_new(Collector *inner_coll, int32_t offset) {
+    OffsetCollector *self
         = (OffsetCollector*)VTable_Make_Obj(OFFSETCOLLECTOR);
     return OffsetColl_init(self, inner_coll, offset);
 }
 
 OffsetCollector*
-OffsetColl_init(OffsetCollector *self, Collector *inner_coll, int32_t offset)
-{
+OffsetColl_init(OffsetCollector *self, Collector *inner_coll, int32_t offset) {
     Coll_init((Collector*)self);
     self->offset     = offset;
     self->inner_coll = (Collector*)INCREF(inner_coll);
@@ -115,39 +103,33 @@ OffsetColl_init(OffsetCollector *self, C
 }
 
 void
-OffsetColl_destroy(OffsetCollector *self)
-{
+OffsetColl_destroy(OffsetCollector *self) {
     DECREF(self->inner_coll);
     SUPER_DESTROY(self, OFFSETCOLLECTOR);
 }
 
 void
-OffsetColl_set_reader(OffsetCollector *self, SegReader *reader)
-{
+OffsetColl_set_reader(OffsetCollector *self, SegReader *reader) {
     Coll_Set_Reader(self->inner_coll, reader);
 }
 
 void
-OffsetColl_set_base(OffsetCollector *self, int32_t base)
-{
+OffsetColl_set_base(OffsetCollector *self, int32_t base) {
     Coll_Set_Base(self->inner_coll, base);
 }
 
 void
-OffsetColl_set_matcher(OffsetCollector *self, Matcher *matcher)
-{
+OffsetColl_set_matcher(OffsetCollector *self, Matcher *matcher) {
     Coll_Set_Matcher(self->inner_coll, matcher);
 }
 
 void
-OffsetColl_collect(OffsetCollector *self, int32_t doc_id) 
-{
+OffsetColl_collect(OffsetCollector *self, int32_t doc_id) {
     Coll_Collect(self->inner_coll, (doc_id + self->offset));
 }
 
 bool_t
-OffsetColl_need_score(OffsetCollector *self) 
-{
+OffsetColl_need_score(OffsetCollector *self) {
     return Coll_Need_Score(self->inner_coll);
 }
 

Modified: incubator/lucy/trunk/core/Lucy/Search/Collector/SortCollector.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Collector/SortCollector.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Collector/SortCollector.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Collector/SortCollector.c Sun May  1 23:50:24 2011
@@ -66,16 +66,14 @@ static INLINE bool_t
 SI_competitive(SortCollector *self, int32_t doc_id);
 
 SortCollector*
-SortColl_new(Schema *schema, SortSpec *sort_spec, uint32_t wanted) 
-{
+SortColl_new(Schema *schema, SortSpec *sort_spec, uint32_t wanted) {
     SortCollector *self = (SortCollector*)VTable_Make_Obj(SORTCOLLECTOR);
     return SortColl_init(self, schema, sort_spec, wanted);
 }
 
 // Default to sort-by-score-then-doc-id.
 static VArray*
-S_default_sort_rules()
-{
+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));
@@ -84,9 +82,8 @@ S_default_sort_rules()
 
 SortCollector*
 SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec,
-              uint32_t wanted)
-{
-    VArray *rules   = sort_spec 
+              uint32_t wanted) {
+    VArray *rules = sort_spec
                     ? (VArray*)INCREF(SortSpec_Get_Rules(sort_spec))
                     : S_default_sort_rules();
     uint32_t num_rules = VA_Get_Size(rules);
@@ -127,16 +124,16 @@ SortColl_init(SortCollector *self, Schem
         SortRule *rule   = (SortRule*)VA_Fetch(rules, i);
         int32_t rule_type  = SortRule_Get_Type(rule);
         self->actions[i] = S_derive_action(rule, NULL);
-        if  (rule_type == SortRule_SCORE) { 
-            self->need_score = true; 
+        if (rule_type == SortRule_SCORE) {
+            self->need_score = true;
         }
-        else if (rule_type == SortRule_FIELD) { 
+        else if (rule_type == SortRule_FIELD) {
             CharBuf *field = SortRule_Get_Field(rule);
             FieldType *type = Schema_Fetch_Type(schema, field);
             if (!type || !FType_Sortable(type)) {
                 THROW(ERR, "'%o' isn't a sortable field", field);
             }
-            self->need_values = true; 
+            self->need_values = true;
         }
     }
 
@@ -144,7 +141,7 @@ SortColl_init(SortCollector *self, Schem
     // ascending order, Collect() will favor lower doc numbers -- so we may
     // not need to execute a final COMPARE_BY_DOC_ID action.
     self->num_actions = num_rules;
-    if (self->actions[ num_rules - 1 ] == COMPARE_BY_DOC_ID) {
+    if (self->actions[num_rules - 1] == COMPARE_BY_DOC_ID) {
         self->num_actions--;
     }
 
@@ -168,8 +165,7 @@ SortColl_init(SortCollector *self, Schem
 }
 
 void
-SortColl_destroy(SortCollector *self) 
-{
+SortColl_destroy(SortCollector *self) {
     DECREF(self->hit_q);
     DECREF(self->rules);
     DECREF(self->bumped);
@@ -181,8 +177,7 @@ SortColl_destroy(SortCollector *self) 
 }
 
 static int8_t
-S_derive_action(SortRule *rule, SortCache *cache)
-{
+S_derive_action(SortRule *rule, SortCache *cache) {
     int32_t  rule_type = SortRule_Get_Type(rule);
     bool_t reverse   = !!SortRule_Get_Reverse(rule);
 
@@ -228,9 +223,8 @@ S_derive_action(SortRule *rule, SortCach
 }
 
 void
-SortColl_set_reader(SortCollector *self, SegReader *reader) 
-{
-    SortReader *sort_reader 
+SortColl_set_reader(SortCollector *self, SegReader *reader) {
+    SortReader *sort_reader
         = (SortReader*)SegReader_Fetch(reader, VTable_Get_Name(SORTREADER));
 
     // Reset threshold variables and trigger auto-action behavior.
@@ -247,8 +241,8 @@ SortColl_set_reader(SortCollector *self,
             SortRule  *rule  = (SortRule*)VA_Fetch(self->rules, i);
             CharBuf   *field = SortRule_Get_Field(rule);
             SortCache *cache = field
-                             ? SortReader_Fetch_Sort_Cache(sort_reader, field)
-                             : NULL;
+                               ? SortReader_Fetch_Sort_Cache(sort_reader, field)
+                               : NULL;
             self->sort_caches[i] = cache;
             self->derived_actions[i] = S_derive_action(rule, cache);
             if (cache) { self->ord_arrays[i] = SortCache_Get_Ords(cache); }
@@ -260,26 +254,25 @@ SortColl_set_reader(SortCollector *self,
 }
 
 VArray*
-SortColl_pop_match_docs(SortCollector *self)
-{
+SortColl_pop_match_docs(SortCollector *self) {
     return HitQ_Pop_All(self->hit_q);
 }
 
 uint32_t
-SortColl_get_total_hits(SortCollector *self) { return self->total_hits; }
+SortColl_get_total_hits(SortCollector *self) {
+    return self->total_hits;
+}
 
 bool_t
-SortColl_need_score(SortCollector *self)
-{
+SortColl_need_score(SortCollector *self) {
     return self->need_score;
 }
 
 void
-SortColl_collect(SortCollector *self, int32_t doc_id) 
-{
+SortColl_collect(SortCollector *self, int32_t doc_id) {
     // Add to the total number of hits.
     self->total_hits++;
-    
+
     // Collect this hit if it's competitive.
     if (SI_competitive(self, doc_id)) {
         MatchDoc *const match_doc = self->bumped;
@@ -299,12 +292,12 @@ SortColl_collect(SortCollector *self, in
                 Obj       *old_val = (Obj*)VA_Delete(values, i);
                 if (cache) {
                     int32_t ord = SortCache_Ordinal(cache, doc_id);
-                    Obj *blank = old_val 
-                               ? old_val 
-                               : SortCache_Make_Blank(cache);
+                    Obj *blank = old_val
+                                 ? old_val
+                                 : SortCache_Make_Blank(cache);
                     Obj *val = SortCache_Value(cache, ord, blank);
                     if (val) { VA_Store(values, i, (Obj*)val); }
-                    else { DECREF(blank); }
+                    else     { DECREF(blank); }
                 }
             }
         }
@@ -328,9 +321,9 @@ SortColl_collect(SortCollector *self, in
         }
         else {
             // The queue isn't full yet, so create a fresh MatchDoc.
-            VArray *values = self->need_values 
-                           ? VA_new(self->num_rules)
-                           : NULL;
+            VArray *values = self->need_values
+                             ? VA_new(self->num_rules)
+                             : NULL;
             float fake_score = self->need_score ? F32_NEGINF : F32_NAN;
             self->bumped = MatchDoc_new(I32_MAX, fake_score, values);
             DECREF(values);
@@ -340,40 +333,35 @@ SortColl_collect(SortCollector *self, in
 }
 
 static INLINE int32_t
-SI_compare_by_ord1(SortCollector *self, uint32_t tick, int32_t a, int32_t b)
-{
+SI_compare_by_ord1(SortCollector *self, uint32_t tick, int32_t a, int32_t b) {
     void *const ords = self->ord_arrays[tick];
     int32_t a_ord = NumUtil_u1get(ords, a);
     int32_t b_ord = NumUtil_u1get(ords, b);
     return a_ord - b_ord;
 }
 static INLINE int32_t
-SI_compare_by_ord2(SortCollector *self, uint32_t tick, int32_t a, int32_t b)
-{
+SI_compare_by_ord2(SortCollector *self, uint32_t tick, int32_t a, int32_t b) {
     void *const ords = self->ord_arrays[tick];
     int32_t a_ord = NumUtil_u2get(ords, a);
     int32_t b_ord = NumUtil_u2get(ords, b);
     return a_ord - b_ord;
 }
 static INLINE int32_t
-SI_compare_by_ord4(SortCollector *self, uint32_t tick, int32_t a, int32_t b)
-{
+SI_compare_by_ord4(SortCollector *self, uint32_t tick, int32_t a, int32_t b) {
     void *const ords = self->ord_arrays[tick];
     int32_t a_ord = NumUtil_u4get(ords, a);
     int32_t b_ord = NumUtil_u4get(ords, b);
     return a_ord - b_ord;
 }
 static INLINE int32_t
-SI_compare_by_ord8(SortCollector *self, uint32_t tick, int32_t a, int32_t b)
-{
+SI_compare_by_ord8(SortCollector *self, uint32_t tick, int32_t a, int32_t b) {
     uint8_t *ords = (uint8_t*)self->ord_arrays[tick];
     int32_t a_ord = ords[a];
     int32_t b_ord = ords[b];
     return a_ord - b_ord;
 }
 static INLINE int32_t
-SI_compare_by_ord16(SortCollector *self, uint32_t tick, int32_t a, int32_t b)
-{
+SI_compare_by_ord16(SortCollector *self, uint32_t tick, int32_t a, int32_t b) {
     uint8_t *ord_bytes = (uint8_t*)self->ord_arrays[tick];
     uint8_t *address_a = ord_bytes + a * sizeof(uint16_t);
     uint8_t *address_b = ord_bytes + b * sizeof(uint16_t);
@@ -382,8 +370,7 @@ SI_compare_by_ord16(SortCollector *self,
     return ord_a - ord_b;
 }
 static INLINE int32_t
-SI_compare_by_ord32(SortCollector *self, uint32_t tick, int32_t a, int32_t b)
-{
+SI_compare_by_ord32(SortCollector *self, uint32_t tick, int32_t a, int32_t b) {
     uint8_t *ord_bytes = (uint8_t*)self->ord_arrays[tick];
     uint8_t *address_a = ord_bytes + a * sizeof(uint32_t);
     uint8_t *address_b = ord_bytes + b * sizeof(uint32_t);
@@ -392,18 +379,16 @@ SI_compare_by_ord32(SortCollector *self,
     return ord_a - ord_b;
 }
 static INLINE int32_t
-SI_compare_by_native_ord16(SortCollector *self, uint32_t tick, 
-                           int32_t a, int32_t b)
-{
+SI_compare_by_native_ord16(SortCollector *self, uint32_t tick,
+                           int32_t a, int32_t b) {
     uint16_t *ords = (uint16_t*)self->ord_arrays[tick];
     int32_t a_ord = ords[a];
     int32_t b_ord = ords[b];
     return a_ord - b_ord;
 }
 static INLINE int32_t
-SI_compare_by_native_ord32(SortCollector *self, uint32_t tick, 
-                           int32_t a, int32_t b)
-{
+SI_compare_by_native_ord32(SortCollector *self, uint32_t tick,
+                           int32_t a, int32_t b) {
     int32_t *ords = (int32_t*)self->ord_arrays[tick];
     return ords[a] - ords[b];
 }
@@ -411,19 +396,17 @@ SI_compare_by_native_ord32(SortCollector
 // Bounds checking for doc id against the segment doc_max.  We assume that any
 // sort cache ord arrays can accomodate lookups up to this number.
 static INLINE int32_t
-SI_validate_doc_id(SortCollector *self, int32_t doc_id)
-{
+SI_validate_doc_id(SortCollector *self, int32_t doc_id) {
     // Check as uint32_t since we're using these doc ids as array indexes.
     if ((uint32_t)doc_id > (uint32_t)self->seg_doc_max) {
-        THROW(ERR, "Doc ID %i32 greater than doc max %i32", doc_id, 
-            self->seg_doc_max);
+        THROW(ERR, "Doc ID %i32 greater than doc max %i32", doc_id,
+              self->seg_doc_max);
     }
     return doc_id;
 }
 
 static INLINE bool_t
-SI_competitive(SortCollector *self, int32_t doc_id)
-{
+SI_competitive(SortCollector *self, int32_t doc_id) {
     /* Ordinarily, we would cache local copies of more member variables in
      * const automatic variables in order to improve code clarity and provide
      * more hints to the compiler about what variables are actually invariant
@@ -457,9 +440,9 @@ SI_competitive(SortCollector *self, int3
             case COMPARE_BY_SCORE: {
                     float score = Matcher_Score(self->matcher);
                     if (*(int32_t*)&score == *(int32_t*)&self->bubble_score) {
-                        break; 
+                        break;
                     }
-                    if  (score > self->bubble_score) {
+                    if (score > self->bubble_score) {
                         self->bumped->score = score;
                         return true;
                     }
@@ -471,9 +454,9 @@ SI_competitive(SortCollector *self, int3
             case COMPARE_BY_SCORE_REV: {
                     float score = Matcher_Score(self->matcher);
                     if (*(int32_t*)&score == *(int32_t*)&self->bubble_score) {
-                        break; 
+                        break;
                     }
-                    if  (score < self->bubble_score) {
+                    if (score < self->bubble_score) {
                         self->bumped->score = score;
                         return true;
                     }
@@ -483,122 +466,154 @@ SI_competitive(SortCollector *self, int3
                 }
                 break;
             case COMPARE_BY_DOC_ID:
-                if      (doc_id > self->bubble_doc) { return false; }
+                if (doc_id > self->bubble_doc)      { return false; }
                 else if (doc_id < self->bubble_doc) { return true; }
                 break;
             case COMPARE_BY_DOC_ID_REV:
-                if      (doc_id > self->bubble_doc) { return true; }
+                if (doc_id > self->bubble_doc)      { return true; }
                 else if (doc_id < self->bubble_doc) { return false; }
                 break;
             case COMPARE_BY_ORD1: {
-                    int32_t comparison = SI_compare_by_ord1(self, i,
-                        SI_validate_doc_id(self, doc_id), self->bubble_doc);
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord1(
+                              self, i, SI_validate_doc_id(self, doc_id),
+                              self->bubble_doc);
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD1_REV: {
-                    int32_t comparison = SI_compare_by_ord1(self, i,
-                        self->bubble_doc, SI_validate_doc_id(self, doc_id));
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord1(
+                              self, i, self->bubble_doc,
+                              SI_validate_doc_id(self, doc_id));
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD2: {
-                    int32_t comparison = SI_compare_by_ord2(self, i,
-                        SI_validate_doc_id(self, doc_id), self->bubble_doc);
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord2(
+                              self, i, SI_validate_doc_id(self, doc_id),
+                              self->bubble_doc);
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD2_REV: {
-                    int32_t comparison = SI_compare_by_ord2(self, i,
-                        self->bubble_doc, SI_validate_doc_id(self, doc_id));
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord2(
+                              self, i, self->bubble_doc,
+                              SI_validate_doc_id(self, doc_id));
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD4: {
-                    int32_t comparison = SI_compare_by_ord4(self, i,
-                        SI_validate_doc_id(self, doc_id), self->bubble_doc);
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord4(
+                              self, i, SI_validate_doc_id(self, doc_id),
+                              self->bubble_doc);
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD4_REV: {
-                    int32_t comparison = SI_compare_by_ord4(self, i,
-                        self->bubble_doc, SI_validate_doc_id(self, doc_id));
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord4(
+                              self, i, self->bubble_doc,
+                              SI_validate_doc_id(self, doc_id));
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD8: {
-                    int32_t comparison = SI_compare_by_ord8(self, i,
-                        SI_validate_doc_id(self, doc_id), self->bubble_doc);
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord8(
+                              self, i, SI_validate_doc_id(self, doc_id),
+                              self->bubble_doc);
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD8_REV: {
-                    int32_t comparison = SI_compare_by_ord8(self, i,
-                        self->bubble_doc, SI_validate_doc_id(self, doc_id));
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord8(
+                              self, i, self->bubble_doc,
+                              SI_validate_doc_id(self, doc_id));
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD16: {
-                    int32_t comparison = SI_compare_by_ord16(self, i,
-                        SI_validate_doc_id(self, doc_id), self->bubble_doc);
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord16(
+                              self, i, SI_validate_doc_id(self, doc_id),
+                              self->bubble_doc);
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD16_REV: {
-                    int32_t comparison = SI_compare_by_ord16(self, i,
-                        self->bubble_doc, SI_validate_doc_id(self, doc_id));
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord16(
+                              self, i, self->bubble_doc,
+                              SI_validate_doc_id(self, doc_id));
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD32: {
-                    int32_t comparison = SI_compare_by_ord32(self, i,
-                        SI_validate_doc_id(self, doc_id), self->bubble_doc);
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord32(
+                              self, i, SI_validate_doc_id(self, doc_id),
+                              self->bubble_doc);
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_ORD32_REV: {
-                    int32_t comparison = SI_compare_by_ord32(self, i,
-                        self->bubble_doc, SI_validate_doc_id(self, doc_id));
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_ord32(
+                              self, i, self->bubble_doc,
+                              SI_validate_doc_id(self, doc_id));
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_NATIVE_ORD16: {
-                    int32_t comparison = SI_compare_by_native_ord16(self, i,
-                        SI_validate_doc_id(self, doc_id), self->bubble_doc);
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_native_ord16(
+                              self, i, SI_validate_doc_id(self, doc_id),
+                              self->bubble_doc);
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_NATIVE_ORD16_REV: {
-                    int32_t comparison = SI_compare_by_native_ord16(self, i,
-                        self->bubble_doc, SI_validate_doc_id(self, doc_id));
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_native_ord16(
+                              self, i, self->bubble_doc,
+                              SI_validate_doc_id(self, doc_id));
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_NATIVE_ORD32: {
-                    int32_t comparison = SI_compare_by_native_ord32(self, i,
-                        SI_validate_doc_id(self, doc_id), self->bubble_doc);
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_native_ord32(
+                              self, i, SI_validate_doc_id(self, doc_id),
+                              self->bubble_doc);
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;
             case COMPARE_BY_NATIVE_ORD32_REV: {
-                    int32_t comparison = SI_compare_by_native_ord32(self, i,
-                        self->bubble_doc, SI_validate_doc_id(self, doc_id));
-                    if      (comparison < 0) { return true; }
+                    int32_t comparison
+                        = SI_compare_by_native_ord32(
+                              self, i, self->bubble_doc,
+                              SI_validate_doc_id(self, doc_id));
+                    if (comparison < 0)      { return true; }
                     else if (comparison > 0) { return false; }
                 }
                 break;

Modified: incubator/lucy/trunk/core/Lucy/Search/Collector/SortCollector.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Collector/SortCollector.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Collector/SortCollector.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Collector/SortCollector.cfh Sun May  1 23:50:24 2011
@@ -42,7 +42,7 @@ class Lucy::Search::Collector::SortColle
     bool_t          need_score;
     bool_t          need_values;
 
-    inert incremented SortCollector* 
+    inert incremented SortCollector*
     new(Schema *schema = NULL, SortSpec *sort_spec = NULL, uint32_t wanted);
 
     /**
@@ -51,13 +51,13 @@ class Lucy::Search::Collector::SortColle
      * and ascending doc id second.
      * @param wanted Maximum number of hits to collect.
      */
-    inert SortCollector* 
-    init(SortCollector *self, Schema *schema = NULL, 
+    inert SortCollector*
+    init(SortCollector *self, Schema *schema = NULL,
          SortSpec *sort_spec = NULL, uint32_t wanted);
 
     /** Keep highest ranking docs.
      */
-    public void 
+    public void
     Collect(SortCollector *self, int32_t doc_id);
 
     /** Empty out the HitQueue and return an array of sorted MatchDocs.

Modified: incubator/lucy/trunk/core/Lucy/Search/Compiler.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Compiler.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Compiler.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Compiler.c Sun May  1 23:50:24 2011
@@ -31,8 +31,7 @@
 
 Compiler*
 Compiler_init(Compiler *self, Query *parent, Searcher *searcher,
-            Similarity *sim, float boost)
-{
+              Similarity *sim, float boost) {
     Query_init((Query*)self, boost);
     if (!sim) {
         Schema *schema = Searcher_Get_Schema(searcher);
@@ -45,55 +44,54 @@ Compiler_init(Compiler *self, Query *par
 }
 
 void
-Compiler_destroy(Compiler *self)
-{
+Compiler_destroy(Compiler *self) {
     DECREF(self->parent);
     DECREF(self->sim);
     SUPER_DESTROY(self, COMPILER);
 }
 
 float
-Compiler_get_weight(Compiler *self)
-{
+Compiler_get_weight(Compiler *self) {
     return Compiler_Get_Boost(self);
 }
 
 Similarity*
-Compiler_get_similarity(Compiler *self) { return self->sim; }
+Compiler_get_similarity(Compiler *self) {
+    return self->sim;
+}
+
 Query*
-Compiler_get_parent(Compiler *self)     { return self->parent; }
+Compiler_get_parent(Compiler *self) {
+    return self->parent;
+}
 
 float
-Compiler_sum_of_squared_weights(Compiler *self)
-{
+Compiler_sum_of_squared_weights(Compiler *self) {
     UNUSED_VAR(self);
     return 1.0f;
 }
 
 void
-Compiler_apply_norm_factor(Compiler *self, float factor)
-{
+Compiler_apply_norm_factor(Compiler *self, float factor) {
     UNUSED_VAR(self);
     UNUSED_VAR(factor);
 }
 
 void
-Compiler_normalize(Compiler *self)
-{
-    // factor = ( tf_q * idf_t )
-    float factor = Compiler_Sum_Of_Squared_Weights(self); 
+Compiler_normalize(Compiler *self) {
+    // factor = (tf_q * idf_t)
+    float factor = Compiler_Sum_Of_Squared_Weights(self);
 
     // factor /= norm_q
     factor = Sim_Query_Norm(self->sim, factor);
 
     // weight *= factor
-    Compiler_Apply_Norm_Factor(self, factor); 
+    Compiler_Apply_Norm_Factor(self, factor);
 }
 
 VArray*
-Compiler_highlight_spans(Compiler *self, Searcher *searcher, 
-                       DocVector *doc_vec, const CharBuf *field)
-{
+Compiler_highlight_spans(Compiler *self, Searcher *searcher,
+                         DocVector *doc_vec, const CharBuf *field) {
     UNUSED_VAR(self);
     UNUSED_VAR(searcher);
     UNUSED_VAR(doc_vec);
@@ -102,8 +100,7 @@ Compiler_highlight_spans(Compiler *self,
 }
 
 CharBuf*
-Compiler_to_string(Compiler *self)
-{
+Compiler_to_string(Compiler *self) {
     CharBuf *stringified_query = Query_To_String(self->parent);
     CharBuf *string = CB_new_from_trusted_utf8("compiler(", 9);
     CB_Cat(string, stringified_query);
@@ -113,8 +110,7 @@ Compiler_to_string(Compiler *self)
 }
 
 bool_t
-Compiler_equals(Compiler *self, Obj *other)
-{
+Compiler_equals(Compiler *self, Obj *other) {
     Compiler *twin = (Compiler*)other;
     if (twin == self) return true;
     if (!Obj_Is_A(other, COMPILER)) return false;
@@ -125,8 +121,7 @@ Compiler_equals(Compiler *self, Obj *oth
 }
 
 void
-Compiler_serialize(Compiler *self, OutStream *outstream)
-{
+Compiler_serialize(Compiler *self, OutStream *outstream) {
     ABSTRACT_CLASS_CHECK(self, COMPILER);
     OutStream_Write_F32(outstream, self->boost);
     FREEZE(self->parent, outstream);
@@ -134,8 +129,7 @@ Compiler_serialize(Compiler *self, OutSt
 }
 
 Compiler*
-Compiler_deserialize(Compiler *self, InStream *instream)
-{
+Compiler_deserialize(Compiler *self, InStream *instream) {
     if (!self) THROW(ERR, "Compiler_Deserialize is abstract");
     self->boost  = InStream_Read_F32(instream);
     self->parent = (Query*)THAW(instream);

Modified: incubator/lucy/trunk/core/Lucy/Search/Compiler.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Compiler.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Compiler.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Compiler.cfh Sun May  1 23:50:24 2011
@@ -72,7 +72,7 @@ class Lucy::Search::Compiler inherits Lu
      * the parent Query.
      */
     public inert Compiler*
-    init(Compiler *self, Query *parent, Searcher *searcher, 
+    init(Compiler *self, Query *parent, Searcher *searcher,
          Similarity *similarity = NULL, float boost);
 
     /** Factory method returning a Matcher.
@@ -126,7 +126,7 @@ class Lucy::Search::Compiler inherits Lu
      *
      * For a TermQuery, the scoring formula is approximately:
      *
-     *     ( tf_d * idf_t / norm_d ) * ( tf_q * idf_t / norm_q )
+     *     (tf_d * idf_t / norm_d) * (tf_q * idf_t / norm_q)
      *
      * Normalize() is theoretically concerned with applying the second half of
      * that formula to a the Compiler's weight. What actually happens depends
@@ -135,7 +135,7 @@ class Lucy::Search::Compiler inherits Lu
      */
     public void
     Normalize(Compiler *self);
-    
+
     /** Return an array of Span objects, indicating where in the given field
      * the text that matches the parent Query occurs and how well each snippet
      * matches.  The Span's offset and length are measured in Unicode code
@@ -148,7 +148,7 @@ class Lucy::Search::Compiler inherits Lu
      * @param field The name of the field.
      */
     public incremented VArray*
-    Highlight_Spans(Compiler *self, Searcher *searcher, 
+    Highlight_Spans(Compiler *self, Searcher *searcher,
                     DocVector *doc_vec, const CharBuf *field);
 
     public void

Modified: incubator/lucy/trunk/core/Lucy/Search/HitQueue.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/HitQueue.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/HitQueue.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/HitQueue.c Sun May  1 23:50:24 2011
@@ -37,20 +37,19 @@
 #define ACTIONS_MASK          0xF
 
 HitQueue*
-HitQ_new(Schema *schema, SortSpec *sort_spec, uint32_t wanted) 
-{
+HitQ_new(Schema *schema, SortSpec *sort_spec, uint32_t wanted) {
     HitQueue *self = (HitQueue*)VTable_Make_Obj(HITQUEUE);
     return HitQ_init(self, schema, sort_spec, wanted);
 }
 
 HitQueue*
-HitQ_init(HitQueue *self, Schema *schema, SortSpec *sort_spec, uint32_t wanted)
-{
+HitQ_init(HitQueue *self, Schema *schema, SortSpec *sort_spec,
+          uint32_t wanted) {
     if (sort_spec) {
         uint32_t i;
-        VArray *rules      = SortSpec_Get_Rules(sort_spec);
-        uint32_t   num_rules  = VA_Get_Size(rules);
-        uint32_t   action_num = 0;
+        VArray   *rules      = SortSpec_Get_Rules(sort_spec);
+        uint32_t  num_rules  = VA_Get_Size(rules);
+        uint32_t  action_num = 0;
 
         if (!schema) {
             THROW(ERR, "Can't supply sort_spec without schema");
@@ -67,29 +66,29 @@ HitQ_init(HitQueue *self, Schema *schema
             bool_t    reverse   = SortRule_Get_Reverse(rule);
 
             if (rule_type == SortRule_SCORE) {
-                self->actions[action_num++] = reverse 
-                                            ? COMPARE_BY_SCORE_REV
-                                            : COMPARE_BY_SCORE;
+                self->actions[action_num++] = reverse
+                                              ? COMPARE_BY_SCORE_REV
+                                              : COMPARE_BY_SCORE;
             }
             else if (rule_type == SortRule_DOC_ID) {
-                self->actions[action_num++] = reverse 
-                                            ? COMPARE_BY_DOC_ID_REV
-                                            : COMPARE_BY_DOC_ID;
+                self->actions[action_num++] = reverse
+                                              ? COMPARE_BY_DOC_ID_REV
+                                              : COMPARE_BY_DOC_ID;
             }
             else if (rule_type == SortRule_FIELD) {
                 CharBuf   *field = SortRule_Get_Field(rule);
                 FieldType *type  = Schema_Fetch_Type(schema, field);
                 if (type) {
                     self->field_types[action_num] = (FieldType*)INCREF(type);
-                    self->actions[action_num++] = reverse 
-                                                ? COMPARE_BY_VALUE_REV
-                                                : COMPARE_BY_VALUE;
+                    self->actions[action_num++] = reverse
+                                                  ? COMPARE_BY_VALUE_REV
+                                                  : COMPARE_BY_VALUE;
                     self->need_values = true;
                 }
-                else { 
+                else {
                     // Skip over fields we don't know how to sort on.
-                    continue; 
-                } 
+                    continue;
+                }
             }
             else {
                 THROW(ERR, "Unknown SortRule type: %i32", rule_type);
@@ -107,11 +106,10 @@ HitQ_init(HitQueue *self, Schema *schema
 }
 
 void
-HitQ_destroy(HitQueue *self)
-{
+HitQ_destroy(HitQueue *self) {
     FieldType **types = self->field_types;
     FieldType **const limit = types + self->num_actions - 1;
-    for ( ; types < limit; types++) { 
+    for (; types < limit; types++) {
         if (types) { DECREF(*types); }
     }
     FREEMEM(self->actions);
@@ -120,10 +118,9 @@ HitQ_destroy(HitQueue *self)
 }
 
 Obj*
-HitQ_jostle(HitQueue *self, Obj *element)
-{
+HitQ_jostle(HitQueue *self, Obj *element) {
     MatchDoc *match_doc = (MatchDoc*)CERTIFY(element, MATCHDOC);
-    HitQ_jostle_t super_jostle 
+    HitQ_jostle_t super_jostle
         = (HitQ_jostle_t)SUPER_METHOD(HITQUEUE, HitQ, Jostle);
     if (self->need_values) {
         CERTIFY(match_doc->values, VARRAY);
@@ -132,8 +129,7 @@ HitQ_jostle(HitQueue *self, Obj *element
 }
 
 static INLINE int32_t
-SI_compare_by_value(HitQueue *self, uint32_t tick, MatchDoc *a, MatchDoc *b)
-{
+SI_compare_by_value(HitQueue *self, uint32_t tick, MatchDoc *a, MatchDoc *b) {
     Obj *a_val = VA_Fetch(a->values, tick);
     Obj *b_val = VA_Fetch(b->values, tick);
     FieldType *field_type = self->field_types[tick];
@@ -141,8 +137,7 @@ SI_compare_by_value(HitQueue *self, uint
 }
 
 bool_t
-HitQ_less_than(HitQueue *self, Obj *obj_a, Obj *obj_b) 
-{
+HitQ_less_than(HitQueue *self, Obj *obj_a, Obj *obj_b) {
     MatchDoc *const a = (MatchDoc*)obj_a;
     MatchDoc *const b = (MatchDoc*)obj_b;
     uint32_t i = 0;
@@ -152,35 +147,35 @@ HitQ_less_than(HitQueue *self, Obj *obj_
         switch (actions[i] & ACTIONS_MASK) {
             case COMPARE_BY_SCORE:
                 // Prefer high scores.
-                if      (a->score > b->score) { return false;   }
-                else if (a->score < b->score) { return true;    }
+                if (a->score > b->score)      { return false; }
+                else if (a->score < b->score) { return true;  }
                 break;
             case COMPARE_BY_SCORE_REV:
-                if      (a->score > b->score) { return true;    }
-                else if (a->score < b->score) { return false;   }
+                if (a->score > b->score)      { return true;  }
+                else if (a->score < b->score) { return false; }
                 break;
             case COMPARE_BY_DOC_ID:
                 // Prefer low doc ids.
-                if      (a->doc_id > b->doc_id) { return true;    }
-                else if (a->doc_id < b->doc_id) { return false;   }
+                if (a->doc_id > b->doc_id)      { return true;  }
+                else if (a->doc_id < b->doc_id) { return false; }
                 break;
-            case COMPARE_BY_DOC_ID_REV:     
-                if      (a->doc_id > b->doc_id) { return false;    }
-                else if (a->doc_id < b->doc_id) { return true;   }
+            case COMPARE_BY_DOC_ID_REV:
+                if (a->doc_id > b->doc_id)      { return false; }
+                else if (a->doc_id < b->doc_id) { return true;  }
                 break;
             case COMPARE_BY_VALUE: {
                     int32_t comparison = SI_compare_by_value(self, i, a, b);
-                    if      (comparison > 0) { return true; }
+                    if (comparison > 0)      { return true;  }
                     else if (comparison < 0) { return false; }
                 }
                 break;
             case COMPARE_BY_VALUE_REV: {
                     int32_t comparison = SI_compare_by_value(self, i, b, a);
-                    if      (comparison > 0) { return true; }
+                    if (comparison > 0)      { return true;  }
                     else if (comparison < 0) { return false; }
                 }
                 break;
-            default:         
+            default:
                 THROW(ERR, "Unexpected action %u8", actions[i]);
         }
 

Modified: incubator/lucy/trunk/core/Lucy/Search/HitQueue.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/HitQueue.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/HitQueue.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/HitQueue.cfh Sun May  1 23:50:24 2011
@@ -40,7 +40,7 @@ class Lucy::Search::HitQueue cnick HitQ
      * @param wanted Max elements the queue can hold.
      */
     inert HitQueue*
-    init(HitQueue *self, Schema *schema = NULL, SortSpec *sort_spec = NULL, 
+    init(HitQueue *self, Schema *schema = NULL, SortSpec *sort_spec = NULL,
          uint32_t wanted);
 
     public void
@@ -50,7 +50,7 @@ class Lucy::Search::HitQueue cnick HitQ
      * values array, then invokes parent method.
      */
     incremented nullable Obj*
-    Jostle(HitQueue *self, decremented Obj *element); 
+    Jostle(HitQueue *self, decremented Obj *element);
 
     bool_t
     Less_Than(HitQueue *self, Obj *a, Obj *b);

Modified: incubator/lucy/trunk/core/Lucy/Search/Hits.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/Hits.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/Hits.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/Hits.c Sun May  1 23:50:24 2011
@@ -26,16 +26,14 @@
 #include "Lucy/Search/TopDocs.h"
 
 Hits*
-Hits_new(Searcher *searcher, TopDocs *top_docs, uint32_t offset)
-{
+Hits_new(Searcher *searcher, TopDocs *top_docs, uint32_t offset) {
     Hits *self = (Hits*)VTable_Make_Obj(HITS);
     return Hits_init(self, searcher, top_docs, offset);
 }
 
 Hits*
-Hits_init(Hits *self, Searcher *searcher, TopDocs *top_docs, uint32_t offset)
-{
-    self->searcher = (Searcher*)INCREF(searcher);
+Hits_init(Hits *self, Searcher *searcher, TopDocs *top_docs, uint32_t offset) {
+    self->searcher   = (Searcher*)INCREF(searcher);
     self->top_docs   = (TopDocs*)INCREF(top_docs);
     self->match_docs = (VArray*)INCREF(TopDocs_Get_Match_Docs(top_docs));
     self->offset     = offset;
@@ -43,8 +41,7 @@ Hits_init(Hits *self, Searcher *searcher
 }
 
 void
-Hits_destroy(Hits *self)
-{
+Hits_destroy(Hits *self) {
     DECREF(self->searcher);
     DECREF(self->top_docs);
     DECREF(self->match_docs);
@@ -52,8 +49,7 @@ Hits_destroy(Hits *self)
 }
 
 HitDoc*
-Hits_next(Hits *self)
-{
+Hits_next(Hits *self) {
     MatchDoc *match_doc = (MatchDoc*)VA_Fetch(self->match_docs, self->offset);
     self->offset++;
 
@@ -65,16 +61,14 @@ Hits_next(Hits *self)
     else {
         // Lazily fetch HitDoc, set score.
         HitDoc *hit_doc = Searcher_Fetch_Doc(self->searcher,
-            match_doc->doc_id);
+                                             match_doc->doc_id);
         HitDoc_Set_Score(hit_doc, match_doc->score);
-
         return hit_doc;
     }
 }
 
 uint32_t
-Hits_total_hits(Hits *self)
-{
+Hits_total_hits(Hits *self) {
     return TopDocs_Get_Total_Hits(self->top_docs);
 }
 

Modified: incubator/lucy/trunk/core/Lucy/Search/IndexSearcher.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/IndexSearcher.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/IndexSearcher.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/IndexSearcher.c Sun May  1 23:50:24 2011
@@ -44,15 +44,13 @@
 #include "Lucy/Store/FSFolder.h"
 
 IndexSearcher*
-IxSearcher_new(Obj *index)
-{
+IxSearcher_new(Obj *index) {
     IndexSearcher *self = (IndexSearcher*)VTable_Make_Obj(INDEXSEARCHER);
     return IxSearcher_init(self, index);
 }
 
 IndexSearcher*
-IxSearcher_init(IndexSearcher *self, Obj *index)
-{
+IxSearcher_init(IndexSearcher *self, Obj *index) {
     if (Obj_Is_A(index, INDEXREADER)) {
         self->reader = (IndexReader*)INCREF(index);
     }
@@ -63,9 +61,9 @@ IxSearcher_init(IndexSearcher *self, Obj
     self->seg_readers = IxReader_Seg_Readers(self->reader);
     self->seg_starts  = IxReader_Offsets(self->reader);
     self->doc_reader = (DocReader*)IxReader_Fetch(
-        self->reader, VTable_Get_Name(DOCREADER));
+                           self->reader, VTable_Get_Name(DOCREADER));
     self->hl_reader = (HighlightReader*)IxReader_Fetch(
-        self->reader, VTable_Get_Name(HIGHLIGHTREADER));
+                          self->reader, VTable_Get_Name(HIGHLIGHTREADER));
     if (self->doc_reader) { INCREF(self->doc_reader); }
     if (self->hl_reader)  { INCREF(self->hl_reader); }
 
@@ -73,8 +71,7 @@ IxSearcher_init(IndexSearcher *self, Obj
 }
 
 void
-IxSearcher_destroy(IndexSearcher *self)
-{
+IxSearcher_destroy(IndexSearcher *self) {
     DECREF(self->reader);
     DECREF(self->doc_reader);
     DECREF(self->hl_reader);
@@ -84,37 +81,33 @@ IxSearcher_destroy(IndexSearcher *self)
 }
 
 HitDoc*
-IxSearcher_fetch_doc(IndexSearcher *self, int32_t doc_id)
-{
+IxSearcher_fetch_doc(IndexSearcher *self, int32_t doc_id) {
     if (!self->doc_reader) { THROW(ERR, "No DocReader"); }
     return DocReader_Fetch_Doc(self->doc_reader, doc_id);
 }
 
 DocVector*
-IxSearcher_fetch_doc_vec(IndexSearcher *self, int32_t doc_id)
-{
+IxSearcher_fetch_doc_vec(IndexSearcher *self, int32_t doc_id) {
     if (!self->hl_reader) { THROW(ERR, "No HighlightReader"); }
     return HLReader_Fetch_Doc_Vec(self->hl_reader, doc_id);
 }
 
-int32_t 
-IxSearcher_doc_max(IndexSearcher *self)
-{
+int32_t
+IxSearcher_doc_max(IndexSearcher *self) {
     return IxReader_Doc_Max(self->reader);
 }
 
 uint32_t
-IxSearcher_doc_freq(IndexSearcher *self, const CharBuf *field, Obj *term)
-{
-    LexiconReader *lex_reader = (LexiconReader*)IxReader_Fetch(self->reader, 
-        VTable_Get_Name(LEXICONREADER));
+IxSearcher_doc_freq(IndexSearcher *self, const CharBuf *field, Obj *term) {
+    LexiconReader *lex_reader
+        = (LexiconReader*)IxReader_Fetch(self->reader,
+                                         VTable_Get_Name(LEXICONREADER));
     return lex_reader ? LexReader_Doc_Freq(lex_reader, field, term) : 0;
 }
 
 TopDocs*
-IxSearcher_top_docs(IndexSearcher *self, Query *query, uint32_t num_wanted, 
-                    SortSpec *sort_spec)
-{
+IxSearcher_top_docs(IndexSearcher *self, Query *query, uint32_t num_wanted,
+                    SortSpec *sort_spec) {
     Schema        *schema    = IxSearcher_Get_Schema(self);
     uint32_t       doc_max   = IxSearcher_Doc_Max(self);
     uint32_t       wanted    = num_wanted > doc_max ? doc_max : num_wanted;
@@ -131,26 +124,26 @@ IxSearcher_top_docs(IndexSearcher *self,
 }
 
 void
-IxSearcher_collect(IndexSearcher *self, Query *query, Collector *collector)
-{
+IxSearcher_collect(IndexSearcher *self, Query *query, Collector *collector) {
     uint32_t i, max;
-    VArray   *const seg_readers  = self->seg_readers;
-    I32Array *const seg_starts   = self->seg_starts;
-    bool_t    need_score         = Coll_Need_Score(collector);
+    VArray   *const seg_readers = self->seg_readers;
+    I32Array *const seg_starts  = self->seg_starts;
+    bool_t    need_score        = Coll_Need_Score(collector);
     Compiler *compiler = Query_Is_A(query, COMPILER)
-                       ? (Compiler*)INCREF(query)
-                       : Query_Make_Compiler(query, (Searcher*)self, 
-                                             Query_Get_Boost(query));
+                         ? (Compiler*)INCREF(query)
+                         : Query_Make_Compiler(query, (Searcher*)self,
+                                               Query_Get_Boost(query));
 
     // Accumulate hits into the Collector.
     for (i = 0, max = VA_Get_Size(seg_readers); i < max; i++) {
         SegReader *seg_reader = (SegReader*)VA_Fetch(seg_readers, i);
         DeletionsReader *del_reader = (DeletionsReader*)SegReader_Fetch(
-            seg_reader, VTable_Get_Name(DELETIONSREADER));
-        Matcher *matcher 
+                                          seg_reader,
+                                          VTable_Get_Name(DELETIONSREADER));
+        Matcher *matcher
             = Compiler_Make_Matcher(compiler, seg_reader, need_score);
         if (matcher) {
-            int32_t seg_start = I32Arr_Get(seg_starts, i);
+            int32_t  seg_start = I32Arr_Get(seg_starts, i);
             Matcher *deletions = DelReader_Iterator(del_reader);
             Coll_Set_Reader(collector, seg_reader);
             Coll_Set_Base(collector, seg_start);
@@ -165,11 +158,12 @@ IxSearcher_collect(IndexSearcher *self, 
 }
 
 IndexReader*
-IxSearcher_get_reader(IndexSearcher *self) { return self->reader; }
+IxSearcher_get_reader(IndexSearcher *self) {
+    return self->reader;
+}
 
 void
-IxSearcher_close(IndexSearcher *self)
-{
+IxSearcher_close(IndexSearcher *self) {
     UNUSED_VAR(self);
 }
 

Modified: incubator/lucy/trunk/core/Lucy/Search/IndexSearcher.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/IndexSearcher.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/IndexSearcher.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/IndexSearcher.cfh Sun May  1 23:50:24 2011
@@ -26,7 +26,7 @@ parcel Lucy;
  * L<Snapshot|Lucy::Index::Snapshot> of the index.  If an index is
  * modified, a new IndexSearcher must be opened to access the changes.
  */
-class Lucy::Search::IndexSearcher cnick IxSearcher 
+class Lucy::Search::IndexSearcher cnick IxSearcher
     inherits Lucy::Search::Searcher {
 
     IndexReader       *reader;