You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/09/01 22:16:57 UTC

[lucy-commits] [09/24] Rename CharBuf to String (cnick Str)

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/SortCache/NumericSortCache.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/NumericSortCache.cfh b/core/Lucy/Index/SortCache/NumericSortCache.cfh
index 375d7af..e1ba6e7 100644
--- a/core/Lucy/Index/SortCache/NumericSortCache.cfh
+++ b/core/Lucy/Index/SortCache/NumericSortCache.cfh
@@ -23,7 +23,7 @@ class Lucy::Index::SortCache::NumericSortCache cnick NumSortCache
     InStream  *dat_in;
 
     inert NumericSortCache*
-    init(NumericSortCache *self, const CharBuf *field, FieldType *type,
+    init(NumericSortCache *self, const String *field, FieldType *type,
          int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
          int32_t ord_width, InStream *ord_in, InStream *dat_in);
 
@@ -35,12 +35,12 @@ class Lucy::Index::SortCache::Float64SortCache cnick F64SortCache
     inherits Lucy::Index::SortCache::NumericSortCache {
 
     public inert incremented Float64SortCache*
-    new(const CharBuf *field, FieldType *type, int32_t cardinality,
+    new(const String *field, FieldType *type, int32_t cardinality,
         int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
         InStream *ord_in, InStream *dat_in);
 
     public inert Float64SortCache*
-    init(Float64SortCache *self, const CharBuf *field, FieldType *type,
+    init(Float64SortCache *self, const String *field, FieldType *type,
          int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
          int32_t ord_width, InStream *ord_in, InStream *dat_in);
 
@@ -55,12 +55,12 @@ class Lucy::Index::SortCache::Float32SortCache cnick F32SortCache
     inherits Lucy::Index::SortCache::NumericSortCache {
 
     public inert incremented Float32SortCache*
-    new(const CharBuf *field, FieldType *type, int32_t cardinality,
+    new(const String *field, FieldType *type, int32_t cardinality,
         int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
         InStream *ord_in, InStream *dat_in);
 
     public inert Float32SortCache*
-    init(Float32SortCache *self, const CharBuf *field, FieldType *type,
+    init(Float32SortCache *self, const String *field, FieldType *type,
          int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
          int32_t ord_width, InStream *ord_in, InStream *dat_in);
 
@@ -75,12 +75,12 @@ class Lucy::Index::SortCache::Int32SortCache cnick I32SortCache
     inherits Lucy::Index::SortCache::NumericSortCache {
 
     public inert incremented Int32SortCache*
-    new(const CharBuf *field, FieldType *type, int32_t cardinality,
+    new(const String *field, FieldType *type, int32_t cardinality,
         int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
         InStream *ord_in, InStream *dat_in);
 
     public inert Int32SortCache*
-    init(Int32SortCache *self, const CharBuf *field, FieldType *type,
+    init(Int32SortCache *self, const String *field, FieldType *type,
          int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
          int32_t ord_width, InStream *ord_in, InStream *dat_in);
 
@@ -95,12 +95,12 @@ class Lucy::Index::SortCache::Int64SortCache cnick I64SortCache
     inherits Lucy::Index::SortCache::NumericSortCache {
 
     public inert incremented Int64SortCache*
-    new(const CharBuf *field, FieldType *type, int32_t cardinality,
+    new(const String *field, FieldType *type, int32_t cardinality,
         int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
         InStream *ord_in, InStream *dat_in);
 
     public inert Int64SortCache*
-    init(Int64SortCache *self, const CharBuf *field, FieldType *type,
+    init(Int64SortCache *self, const String *field, FieldType *type,
          int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
          int32_t ord_width, InStream *ord_in, InStream *dat_in);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/SortCache/TextSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.c b/core/Lucy/Index/SortCache/TextSortCache.c
index 375deff..d9573f2 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.c
+++ b/core/Lucy/Index/SortCache/TextSortCache.c
@@ -25,7 +25,7 @@
 #include "Lucy/Store/Folder.h"
 
 TextSortCache*
-TextSortCache_new(const CharBuf *field, FieldType *type, int32_t cardinality,
+TextSortCache_new(const String *field, FieldType *type, int32_t cardinality,
                   int32_t doc_max, int32_t null_ord, int32_t ord_width,
                   InStream *ord_in, InStream *ix_in, InStream *dat_in) {
     TextSortCache *self = (TextSortCache*)VTable_Make_Obj(TEXTSORTCACHE);
@@ -34,7 +34,7 @@ TextSortCache_new(const CharBuf *field, FieldType *type, int32_t cardinality,
 }
 
 TextSortCache*
-TextSortCache_init(TextSortCache *self, const CharBuf *field,
+TextSortCache_init(TextSortCache *self, const String *field,
                    FieldType *type, int32_t cardinality,
                    int32_t doc_max, int32_t null_ord, int32_t ord_width,
                    InStream *ord_in, InStream *ix_in, InStream *dat_in) {
@@ -109,27 +109,27 @@ TextSortCache_Value_IMP(TextSortCache *self, int32_t ord, Obj *blank) {
             next_ord++;
         }
 
-        // Read character data into CharBuf.
-        CERTIFY(blank, CHARBUF);
+        // Read character data into String.
+        CERTIFY(blank, STRING);
         int64_t len = next_offset - offset;
-        char *ptr = CB_Grow((CharBuf*)blank, (size_t)len);
+        char *ptr = Str_Grow((String*)blank, (size_t)len);
         InStream_Seek(ivars->dat_in, offset);
         InStream_Read_Bytes(ivars->dat_in, ptr, (size_t)len);
         ptr[len] = '\0';
         if (!StrHelp_utf8_valid(ptr, (size_t)len)) {
-            CB_Set_Size((CharBuf*)blank, 0);
+            Str_Set_Size((String*)blank, 0);
             THROW(ERR, "Invalid UTF-8 at %i64 in %o", offset,
                   InStream_Get_Filename(ivars->dat_in));
         }
-        CB_Set_Size((CharBuf*)blank, (size_t)len);
+        Str_Set_Size((String*)blank, (size_t)len);
     }
     return blank;
 }
 
-CharBuf*
+String*
 TextSortCache_Make_Blank_IMP(TextSortCache *self) {
     UNUSED_VAR(self);
-    return CB_new_from_trusted_utf8("", 0);
+    return Str_new_from_trusted_utf8("", 0);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/SortCache/TextSortCache.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.cfh b/core/Lucy/Index/SortCache/TextSortCache.cfh
index 4819303..7fb4f12 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.cfh
+++ b/core/Lucy/Index/SortCache/TextSortCache.cfh
@@ -26,12 +26,12 @@ class Lucy::Index::SortCache::TextSortCache
     InStream  *dat_in;
 
     inert incremented TextSortCache*
-    new(const CharBuf *field, FieldType *type, int32_t cardinality,
+    new(const String *field, FieldType *type, int32_t cardinality,
         int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
         InStream *ord_in, InStream *ix_in, InStream *dat_in);
 
     inert TextSortCache*
-    init(TextSortCache *self, const CharBuf *field, FieldType *type,
+    init(TextSortCache *self, const String *field, FieldType *type,
          int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
          int32_t ord_width, InStream *ord_in, InStream *ix_in,
          InStream *dat_in);
@@ -39,7 +39,7 @@ class Lucy::Index::SortCache::TextSortCache
     public nullable Obj*
     Value(TextSortCache *self, int32_t ord, Obj *blank);
 
-    public incremented CharBuf*
+    public incremented String*
     Make_Blank(TextSortCache *self);
 
     public void

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 51d81ad..cfbee6f 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -57,7 +57,7 @@ typedef struct lucy_SFWriterElem {
 
 SortFieldWriter*
 SortFieldWriter_new(Schema *schema, Snapshot *snapshot, Segment *segment,
-                    PolyReader *polyreader, const CharBuf *field,
+                    PolyReader *polyreader, const String *field,
                     MemoryPool *memory_pool, size_t mem_thresh,
                     OutStream *temp_ord_out, OutStream *temp_ix_out,
                     OutStream *temp_dat_out) {
@@ -71,7 +71,7 @@ SortFieldWriter_new(Schema *schema, Snapshot *snapshot, Segment *segment,
 SortFieldWriter*
 SortFieldWriter_init(SortFieldWriter *self, Schema *schema,
                      Snapshot *snapshot, Segment *segment,
-                     PolyReader *polyreader, const CharBuf *field,
+                     PolyReader *polyreader, const String *field,
                      MemoryPool *memory_pool, size_t mem_thresh,
                      OutStream *temp_ord_out, OutStream *temp_ix_out,
                      OutStream *temp_dat_out) {
@@ -96,7 +96,7 @@ SortFieldWriter_init(SortFieldWriter *self, Schema *schema,
     ivars->ord_width       = 0;
 
     // Assign.
-    ivars->field        = CB_Clone(field);
+    ivars->field        = Str_Clone(field);
     ivars->schema       = (Schema*)INCREF(schema);
     ivars->snapshot     = (Snapshot*)INCREF(snapshot);
     ivars->segment      = (Segment*)INCREF(segment);
@@ -262,11 +262,11 @@ S_write_val(Obj *val, int8_t prim_id, OutStream *ix_out, OutStream *dat_out,
     if (val) {
         switch (prim_id & FType_PRIMITIVE_ID_MASK) {
             case FType_TEXT: {
-                    CharBuf *string = (CharBuf*)val;
+                    String *string = (String*)val;
                     int64_t dat_pos = OutStream_Tell(dat_out) - dat_start;
                     OutStream_Write_I64(ix_out, dat_pos);
-                    OutStream_Write_Bytes(dat_out, (char*)CB_Get_Ptr8(string),
-                                          CB_Get_Size(string));
+                    OutStream_Write_Bytes(dat_out, (char*)Str_Get_Ptr8(string),
+                                          Str_Get_Size(string));
                     break;
                 }
             case FType_BLOB: {
@@ -499,18 +499,18 @@ SortFieldWriter_Flip_IMP(SortFieldWriter *self) {
     }
     else if (num_runs) {
         Folder  *folder = PolyReader_Get_Folder(ivars->polyreader);
-        CharBuf *seg_name = Seg_Get_Name(ivars->segment);
-        CharBuf *ord_path = CB_newf("%o/sort_ord_temp", seg_name);
+        String *seg_name = Seg_Get_Name(ivars->segment);
+        String *ord_path = Str_newf("%o/sort_ord_temp", seg_name);
         ivars->ord_in = Folder_Open_In(folder, ord_path);
         DECREF(ord_path);
         if (!ivars->ord_in) { RETHROW(INCREF(Err_get_error())); }
         if (ivars->var_width) {
-            CharBuf *ix_path = CB_newf("%o/sort_ix_temp", seg_name);
+            String *ix_path = Str_newf("%o/sort_ix_temp", seg_name);
             ivars->ix_in = Folder_Open_In(folder, ix_path);
             DECREF(ix_path);
             if (!ivars->ix_in) { RETHROW(INCREF(Err_get_error())); }
         }
-        CharBuf *dat_path = CB_newf("%o/sort_dat_temp", seg_name);
+        String *dat_path = Str_newf("%o/sort_dat_temp", seg_name);
         ivars->dat_in = Folder_Open_In(folder, dat_path);
         DECREF(dat_path);
         if (!ivars->dat_in) { RETHROW(INCREF(Err_get_error())); }
@@ -614,21 +614,21 @@ SortFieldWriter_Finish_IMP(SortFieldWriter *self) {
 
     int32_t  field_num = ivars->field_num;
     Folder  *folder    = PolyReader_Get_Folder(ivars->polyreader);
-    CharBuf *seg_name  = Seg_Get_Name(ivars->segment);
+    String *seg_name  = Seg_Get_Name(ivars->segment);
 
     // Open streams.
-    CharBuf *ord_path = CB_newf("%o/sort-%i32.ord", seg_name, field_num);
+    String *ord_path = Str_newf("%o/sort-%i32.ord", seg_name, field_num);
     OutStream *ord_out = Folder_Open_Out(folder, ord_path);
     DECREF(ord_path);
     if (!ord_out) { RETHROW(INCREF(Err_get_error())); }
     OutStream *ix_out = NULL;
     if (ivars->var_width) {
-        CharBuf *ix_path = CB_newf("%o/sort-%i32.ix", seg_name, field_num);
+        String *ix_path = Str_newf("%o/sort-%i32.ix", seg_name, field_num);
         ix_out = Folder_Open_Out(folder, ix_path);
         DECREF(ix_path);
         if (!ix_out) { RETHROW(INCREF(Err_get_error())); }
     }
-    CharBuf *dat_path = CB_newf("%o/sort-%i32.dat", seg_name, field_num);
+    String *dat_path = Str_newf("%o/sort-%i32.dat", seg_name, field_num);
     OutStream *dat_out = Folder_Open_Out(folder, dat_path);
     DECREF(dat_path);
     if (!dat_out) { RETHROW(INCREF(Err_get_error())); }
@@ -665,8 +665,8 @@ S_flip_run(SortFieldWriter *run, size_t sub_thresh, InStream *ord_in,
     if (run_ivars->sort_cache) { return; }
 
     // Open the temp files for reading.
-    CharBuf *seg_name  = Seg_Get_Name(run_ivars->segment);
-    CharBuf *ord_alias = CB_newf("%o/sort_ord_temp-%i64-to-%i64", seg_name,
+    String *seg_name  = Seg_Get_Name(run_ivars->segment);
+    String *ord_alias = Str_newf("%o/sort_ord_temp-%i64-to-%i64", seg_name,
                                  run_ivars->ord_start, run_ivars->ord_end);
     InStream *ord_in_dupe
         = InStream_Reopen(ord_in, ord_alias, run_ivars->ord_start,
@@ -674,13 +674,13 @@ S_flip_run(SortFieldWriter *run, size_t sub_thresh, InStream *ord_in,
     DECREF(ord_alias);
     InStream *ix_in_dupe = NULL;
     if (run_ivars->var_width) {
-        CharBuf *ix_alias = CB_newf("%o/sort_ix_temp-%i64-to-%i64", seg_name,
+        String *ix_alias = Str_newf("%o/sort_ix_temp-%i64-to-%i64", seg_name,
                                     run_ivars->ix_start, run_ivars->ix_end);
         ix_in_dupe = InStream_Reopen(ix_in, ix_alias, run_ivars->ix_start,
                                      run_ivars->ix_end - run_ivars->ix_start);
         DECREF(ix_alias);
     }
-    CharBuf *dat_alias = CB_newf("%o/sort_dat_temp-%i64-to-%i64", seg_name,
+    String *dat_alias = Str_newf("%o/sort_dat_temp-%i64-to-%i64", seg_name,
                                  run_ivars->dat_start, run_ivars->dat_end);
     InStream *dat_in_dupe
         = InStream_Reopen(dat_in, dat_alias, run_ivars->dat_start,
@@ -688,7 +688,7 @@ S_flip_run(SortFieldWriter *run, size_t sub_thresh, InStream *ord_in,
     DECREF(dat_alias);
 
     // Get a SortCache.
-    CharBuf *field = Seg_Field_Name(run_ivars->segment, run_ivars->field_num);
+    String *field = Seg_Field_Name(run_ivars->segment, run_ivars->field_num);
     switch (run_ivars->prim_id & FType_PRIMITIVE_ID_MASK) {
         case FType_TEXT:
             run_ivars->sort_cache = (SortCache*)TextSortCache_new(

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/SortFieldWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.cfh b/core/Lucy/Index/SortFieldWriter.cfh
index 210be85..3f6301b 100644
--- a/core/Lucy/Index/SortFieldWriter.cfh
+++ b/core/Lucy/Index/SortFieldWriter.cfh
@@ -18,7 +18,7 @@ parcel Lucy;
 
 class Lucy::Index::SortFieldWriter
     inherits Lucy::Util::SortExternal {
-    CharBuf    *field;
+    String     *field;
     Hash       *uniq_vals;
     Schema     *schema;
     Snapshot   *snapshot;
@@ -54,13 +54,13 @@ class Lucy::Index::SortFieldWriter
 
     inert incremented SortFieldWriter*
     new(Schema *schema, Snapshot *snapshot, Segment *segment,
-        PolyReader *polyreader, const CharBuf *field, MemoryPool *memory_pool,
+        PolyReader *polyreader, const String *field, MemoryPool *memory_pool,
         size_t mem_thresh, OutStream *temp_ord_out, OutStream *temp_ix_out,
         OutStream *temp_dat_out);
 
     inert SortFieldWriter*
     init(SortFieldWriter *self, Schema *schema, Snapshot *snapshot,
-         Segment *segment, PolyReader *polyreader, const CharBuf *field,
+         Segment *segment, PolyReader *polyreader, const String *field,
          MemoryPool *memory_pool, size_t mem_thresh, OutStream *temp_ord_out,
          OutStream *temp_ix_out, OutStream *temp_dat_out);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/SortReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortReader.c b/core/Lucy/Index/SortReader.c
index ed682c2..7275621 100644
--- a/core/Lucy/Index/SortReader.c
+++ b/core/Lucy/Index/SortReader.c
@@ -156,7 +156,7 @@ S_calc_ord_width(int32_t cardinality) {
 }
 
 static SortCache*
-S_lazy_init_sort_cache(DefaultSortReader *self, const CharBuf *field) {
+S_lazy_init_sort_cache(DefaultSortReader *self, const String *field) {
     DefaultSortReaderIVARS *const ivars = DefSortReader_IVARS(self);
 
     // See if we have any values.
@@ -174,13 +174,13 @@ S_lazy_init_sort_cache(DefaultSortReader *self, const CharBuf *field) {
     // Open streams.
     Folder    *folder    = DefSortReader_Get_Folder(self);
     Segment   *segment   = DefSortReader_Get_Segment(self);
-    CharBuf   *seg_name  = Seg_Get_Name(segment);
+    String    *seg_name  = Seg_Get_Name(segment);
     int32_t    field_num = Seg_Field_Num(segment, field);
     int8_t     prim_id   = FType_Primitive_ID(type);
     bool       var_width = (prim_id == FType_TEXT || prim_id == FType_BLOB)
                            ? true
                            : false;
-    CharBuf *ord_path = CB_newf("%o/sort-%i32.ord", seg_name, field_num);
+    String *ord_path = Str_newf("%o/sort-%i32.ord", seg_name, field_num);
     InStream *ord_in = Folder_Open_In(folder, ord_path);
     DECREF(ord_path);
     if (!ord_in) {
@@ -189,7 +189,7 @@ S_lazy_init_sort_cache(DefaultSortReader *self, const CharBuf *field) {
     }
     InStream *ix_in = NULL;
     if (var_width) {
-        CharBuf *ix_path = CB_newf("%o/sort-%i32.ix", seg_name, field_num);
+        String *ix_path = Str_newf("%o/sort-%i32.ix", seg_name, field_num);
         ix_in = Folder_Open_In(folder, ix_path);
         DECREF(ix_path);
         if (!ix_in) {
@@ -197,7 +197,7 @@ S_lazy_init_sort_cache(DefaultSortReader *self, const CharBuf *field) {
                   field, Err_get_error());
         }
     }
-    CharBuf *dat_path = CB_newf("%o/sort-%i32.dat", seg_name, field_num);
+    String *dat_path = Str_newf("%o/sort-%i32.dat", seg_name, field_num);
     InStream *dat_in = Folder_Open_In(folder, dat_path);
     DECREF(dat_path);
     if (!dat_in) {
@@ -258,7 +258,7 @@ S_lazy_init_sort_cache(DefaultSortReader *self, const CharBuf *field) {
 
 SortCache*
 DefSortReader_Fetch_Sort_Cache_IMP(DefaultSortReader *self,
-                                   const CharBuf *field) {
+                                   const String *field) {
     SortCache *cache = NULL;
 
     if (field) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/SortReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortReader.cfh b/core/Lucy/Index/SortReader.cfh
index f8f9b38..ec57b22 100644
--- a/core/Lucy/Index/SortReader.cfh
+++ b/core/Lucy/Index/SortReader.cfh
@@ -27,7 +27,7 @@ abstract class Lucy::Index::SortReader
          int32_t seg_tick = -1);
 
     abstract nullable SortCache*
-    Fetch_Sort_Cache(SortReader *self, const CharBuf *field);
+    Fetch_Sort_Cache(SortReader *self, const String *field);
 
     /** Returns NULL, since multi-segment sort caches cannot be produced by
      * the default implementation.
@@ -55,7 +55,7 @@ class Lucy::Index::DefaultSortReader cnick DefSortReader
          Snapshot *snapshot, VArray *segments, int32_t seg_tick);
 
     nullable SortCache*
-    Fetch_Sort_Cache(DefaultSortReader *self, const CharBuf *field);
+    Fetch_Sort_Cache(DefaultSortReader *self, const String *field);
 
     public void
     Close(DefaultSortReader *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/SortWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortWriter.c b/core/Lucy/Index/SortWriter.c
index 02fc258..cdf5019 100644
--- a/core/Lucy/Index/SortWriter.c
+++ b/core/Lucy/Index/SortWriter.c
@@ -99,20 +99,20 @@ S_lazy_init_field_writer(SortWriter *self, int32_t field_num) {
         // Open temp files.
         if (!ivars->temp_ord_out) {
             Folder  *folder   = ivars->folder;
-            CharBuf *seg_name = Seg_Get_Name(ivars->segment);
-            CharBuf *ord_path = CB_newf("%o/sort_ord_temp", seg_name);
+            String *seg_name = Seg_Get_Name(ivars->segment);
+            String *ord_path = Str_newf("%o/sort_ord_temp", seg_name);
             ivars->temp_ord_out = Folder_Open_Out(folder, ord_path);
             DECREF(ord_path);
             if (!ivars->temp_ord_out) {
                 RETHROW(INCREF(Err_get_error()));
             }
-            CharBuf *ix_path = CB_newf("%o/sort_ix_temp", seg_name);
+            String *ix_path = Str_newf("%o/sort_ix_temp", seg_name);
             ivars->temp_ix_out = Folder_Open_Out(folder, ix_path);
             DECREF(ix_path);
             if (!ivars->temp_ix_out) {
                 RETHROW(INCREF(Err_get_error()));
             }
-            CharBuf *dat_path = CB_newf("%o/sort_dat_temp", seg_name);
+            String *dat_path = Str_newf("%o/sort_dat_temp", seg_name);
             ivars->temp_dat_out = Folder_Open_Out(folder, dat_path);
             DECREF(dat_path);
             if (!ivars->temp_dat_out) {
@@ -120,7 +120,7 @@ S_lazy_init_field_writer(SortWriter *self, int32_t field_num) {
             }
         }
 
-        CharBuf *field = Seg_Field_Name(ivars->segment, field_num);
+        String *field = Seg_Field_Name(ivars->segment, field_num);
         field_writer
             = SortFieldWriter_new(ivars->schema, ivars->snapshot, ivars->segment,
                                   ivars->polyreader, field, ivars->mem_pool,
@@ -169,7 +169,7 @@ SortWriter_Add_Segment_IMP(SortWriter *self, SegReader *reader,
 
     // Proceed field-at-a-time, rather than doc-at-a-time.
     for (uint32_t i = 0, max = VA_Get_Size(fields); i < max; i++) {
-        CharBuf *field = (CharBuf*)VA_Fetch(fields, i);
+        String *field = (String*)VA_Fetch(fields, i);
         SortReader *sort_reader = (SortReader*)SegReader_Fetch(
                                       reader, VTable_Get_Name(SORTREADER));
         SortCache *cache = sort_reader
@@ -216,19 +216,19 @@ SortWriter_Finish_IMP(SortWriter *self) {
         SortFieldWriter *field_writer
             = (SortFieldWriter*)VA_Delete(field_writers, i);
         if (field_writer) {
-            CharBuf *field = Seg_Field_Name(ivars->segment, i);
+            String *field = Seg_Field_Name(ivars->segment, i);
             SortFieldWriter_Flip(field_writer);
             int32_t count = SortFieldWriter_Finish(field_writer);
             Hash_Store(ivars->counts, (Obj*)field,
-                       (Obj*)CB_newf("%i32", count));
+                       (Obj*)Str_newf("%i32", count));
             int32_t null_ord = SortFieldWriter_Get_Null_Ord(field_writer);
             if (null_ord != -1) {
                 Hash_Store(ivars->null_ords, (Obj*)field,
-                           (Obj*)CB_newf("%i32", null_ord));
+                           (Obj*)Str_newf("%i32", null_ord));
             }
             int32_t ord_width = SortFieldWriter_Get_Ord_Width(field_writer);
             Hash_Store(ivars->ord_widths, (Obj*)field,
-                       (Obj*)CB_newf("%i32", ord_width));
+                       (Obj*)Str_newf("%i32", ord_width));
         }
 
         DECREF(field_writer);
@@ -241,14 +241,14 @@ SortWriter_Finish_IMP(SortWriter *self) {
 
     // Clean up.
     Folder  *folder   = ivars->folder;
-    CharBuf *seg_name = Seg_Get_Name(ivars->segment);
-    CharBuf *ord_path = CB_newf("%o/sort_ord_temp", seg_name);
+    String *seg_name = Seg_Get_Name(ivars->segment);
+    String *ord_path = Str_newf("%o/sort_ord_temp", seg_name);
     Folder_Delete(folder, ord_path);
     DECREF(ord_path);
-    CharBuf *ix_path = CB_newf("%o/sort_ix_temp", seg_name);
+    String *ix_path = Str_newf("%o/sort_ix_temp", seg_name);
     Folder_Delete(folder, ix_path);
     DECREF(ix_path);
-    CharBuf *dat_path = CB_newf("%o/sort_dat_temp", seg_name);
+    String *dat_path = Str_newf("%o/sort_dat_temp", seg_name);
     Folder_Delete(folder, dat_path);
     DECREF(dat_path);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/TermInfo.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/TermInfo.c b/core/Lucy/Index/TermInfo.c
index 2f34df8..7a840a4 100644
--- a/core/Lucy/Index/TermInfo.c
+++ b/core/Lucy/Index/TermInfo.c
@@ -89,10 +89,10 @@ TInfo_Set_Skip_FilePos_IMP(TermInfo *self, int64_t filepos) {
 
 // TODO: this should probably be some sort of Dump variant rather than
 // To_String.
-CharBuf*
+String*
 TInfo_To_String_IMP(TermInfo *self) {
     TermInfoIVARS *const ivars = TInfo_IVARS(self);
-    return CB_newf(
+    return Str_newf(
                "doc freq:      %i32\n"
                "post filepos:  %i64\n"
                "skip filepos:  %i64\n"

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/TermInfo.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/TermInfo.cfh b/core/Lucy/Index/TermInfo.cfh
index 5e7d72c..89cb29b 100644
--- a/core/Lucy/Index/TermInfo.cfh
+++ b/core/Lucy/Index/TermInfo.cfh
@@ -75,7 +75,7 @@ class Lucy::Index::TermInfo cnick TInfo inherits Clownfish::Obj {
     public incremented TermInfo*
     Clone(TermInfo *self);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(TermInfo *self);
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/TermVector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/TermVector.c b/core/Lucy/Index/TermVector.c
index b0751cc..2666ceb 100644
--- a/core/Lucy/Index/TermVector.c
+++ b/core/Lucy/Index/TermVector.c
@@ -24,20 +24,20 @@
 #include "Lucy/Util/Freezer.h"
 
 TermVector*
-TV_new(const CharBuf *field, const CharBuf *text, I32Array *positions,
+TV_new(const String *field, const String *text, I32Array *positions,
        I32Array *start_offsets, I32Array *end_offsets) {
     TermVector *self = (TermVector*)VTable_Make_Obj(TERMVECTOR);
     return TV_init(self, field, text, positions, start_offsets, end_offsets);
 }
 
 TermVector*
-TV_init(TermVector *self, const CharBuf *field, const CharBuf *text,
+TV_init(TermVector *self, const String *field, const String *text,
         I32Array *positions, I32Array *start_offsets, I32Array *end_offsets) {
     TermVectorIVARS *const ivars = TV_IVARS(self);
 
     // Assign.
-    ivars->field          = CB_Clone(field);
-    ivars->text           = CB_Clone(text);
+    ivars->field          = Str_Clone(field);
+    ivars->text           = Str_Clone(text);
     ivars->num_pos        = I32Arr_Get_Size(positions);
     ivars->positions      = (I32Array*)INCREF(positions);
     ivars->start_offsets  = (I32Array*)INCREF(start_offsets);
@@ -99,8 +99,8 @@ TV_Serialize_IMP(TermVector *self, OutStream *target) {
 
 TermVector*
 TV_Deserialize_IMP(TermVector *self, InStream *instream) {
-    CharBuf *field = Freezer_read_charbuf(instream);
-    CharBuf *text  = Freezer_read_charbuf(instream);
+    String *field = Freezer_read_charbuf(instream);
+    String *text  = Freezer_read_charbuf(instream);
     uint32_t num_pos = InStream_Read_C32(instream);
 
     // Read positional data.
@@ -132,8 +132,8 @@ TV_Equals_IMP(TermVector *self, Obj *other) {
     if ((TermVector*)other == self) { return true; }
     TermVectorIVARS *const ivars = TV_IVARS(self);
     TermVectorIVARS *const ovars = TV_IVARS((TermVector*)other);
-    if (!CB_Equals(ivars->field, (Obj*)ovars->field)) { return false; }
-    if (!CB_Equals(ivars->text, (Obj*)ovars->text))   { return false; }
+    if (!Str_Equals(ivars->field, (Obj*)ovars->field)) { return false; }
+    if (!Str_Equals(ivars->text, (Obj*)ovars->text))   { return false; }
     if (ivars->num_pos != ovars->num_pos)             { return false; }
 
     int32_t *const posits       = I32Arr_IVARS(ivars->positions)->ints;

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/TermVector.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/TermVector.cfh b/core/Lucy/Index/TermVector.cfh
index 5a83e50..554602a 100644
--- a/core/Lucy/Index/TermVector.cfh
+++ b/core/Lucy/Index/TermVector.cfh
@@ -22,8 +22,8 @@ parcel Lucy;
 class Lucy::Index::TermVector cnick TV
     inherits Clownfish::Obj {
 
-    CharBuf *field;
-    CharBuf *text;
+    String *field;
+    String *text;
     uint32_t num_pos;
     I32Array  *positions;
     I32Array  *start_offsets;
@@ -33,11 +33,11 @@ class Lucy::Index::TermVector cnick TV
      * start_offsets, and end_offsets arrays.
      */
     inert incremented TermVector*
-    new(const CharBuf *field, const CharBuf *text, I32Array *positions,
+    new(const String *field, const String *text, I32Array *positions,
         I32Array *start_offsets, I32Array *end_offsets);
 
     inert TermVector*
-    init(TermVector *self, const CharBuf *field, const CharBuf *text,
+    init(TermVector *self, const String *field, const String *text,
          I32Array *positions, I32Array *start_offsets, I32Array *end_offsets);
 
     I32Array*

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Index/ZombieKeyedHash.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/ZombieKeyedHash.c b/core/Lucy/Index/ZombieKeyedHash.c
index 43140a6..b9ae141 100644
--- a/core/Lucy/Index/ZombieKeyedHash.c
+++ b/core/Lucy/Index/ZombieKeyedHash.c
@@ -46,8 +46,8 @@ ZKHash_Make_Key_IMP(ZombieKeyedHash *self, Obj *key, int32_t hash_sum) {
     Obj *retval = NULL;
     switch (ivars->prim_id & FType_PRIMITIVE_ID_MASK) {
         case FType_TEXT: {
-                CharBuf *source = (CharBuf*)key;
-                size_t size = SStr_size() + CB_Get_Size(source) + 1;
+                String *source = (String*)key;
+                size_t size = SStr_size() + Str_Get_Size(source) + 1;
                 void *allocation = MemPool_Grab(ivars->mem_pool, size);
                 retval = (Obj*)SStr_newf(allocation, size, "%o", source);
             }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/BlobType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/BlobType.c b/core/Lucy/Plan/BlobType.c
index 5bdb337..878ef31 100644
--- a/core/Lucy/Plan/BlobType.c
+++ b/core/Lucy/Plan/BlobType.c
@@ -70,12 +70,12 @@ Hash*
 BlobType_Dump_For_Schema_IMP(BlobType *self) {
     BlobTypeIVARS *const ivars = BlobType_IVARS(self);
     Hash *dump = Hash_new(0);
-    Hash_Store_Str(dump, "type", 4, (Obj*)CB_newf("blob"));
+    Hash_Store_Str(dump, "type", 4, (Obj*)Str_newf("blob"));
 
     // Store attributes that override the defaults -- even if they're
     // meaningless.
     if (ivars->boost != 1.0) {
-        Hash_Store_Str(dump, "boost", 5, (Obj*)CB_newf("%f64", ivars->boost));
+        Hash_Store_Str(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
     }
     if (ivars->indexed) {
         Hash_Store_Str(dump, "indexed", 7, (Obj*)CFISH_TRUE);
@@ -91,7 +91,7 @@ Hash*
 BlobType_Dump_IMP(BlobType *self) {
     Hash *dump = BlobType_Dump_For_Schema(self);
     Hash_Store_Str(dump, "_class", 6,
-                   (Obj*)CB_Clone(BlobType_Get_Class_Name(self)));
+                   (Obj*)Str_Clone(BlobType_Get_Class_Name(self)));
     DECREF(Hash_Delete_Str(dump, "type", 4));
     return dump;
 }
@@ -99,9 +99,9 @@ BlobType_Dump_IMP(BlobType *self) {
 BlobType*
 BlobType_Load_IMP(BlobType *self, Obj *dump) {
     Hash *source = (Hash*)CERTIFY(dump, HASH);
-    CharBuf *class_name = (CharBuf*)Hash_Fetch_Str(source, "_class", 6);
+    String *class_name = (String*)Hash_Fetch_Str(source, "_class", 6);
     VTable *vtable
-        = (class_name != NULL && Obj_Is_A((Obj*)class_name, CHARBUF))
+        = (class_name != NULL && Obj_Is_A((Obj*)class_name, STRING))
           ? VTable_singleton(class_name, NULL)
           : BLOBTYPE;
     BlobType *loaded     = (BlobType*)VTable_Make_Obj(vtable);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/FullTextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/FullTextType.c b/core/Lucy/Plan/FullTextType.c
index 3117037..03fcb3e 100644
--- a/core/Lucy/Plan/FullTextType.c
+++ b/core/Lucy/Plan/FullTextType.c
@@ -81,11 +81,11 @@ Hash*
 FullTextType_Dump_For_Schema_IMP(FullTextType *self) {
     FullTextTypeIVARS *const ivars = FullTextType_IVARS(self);
     Hash *dump = Hash_new(0);
-    Hash_Store_Str(dump, "type", 4, (Obj*)CB_newf("fulltext"));
+    Hash_Store_Str(dump, "type", 4, (Obj*)Str_newf("fulltext"));
 
     // Store attributes that override the defaults.
     if (ivars->boost != 1.0) {
-        Hash_Store_Str(dump, "boost", 5, (Obj*)CB_newf("%f64", ivars->boost));
+        Hash_Store_Str(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
     }
     if (!ivars->indexed) {
         Hash_Store_Str(dump, "indexed", 7, (Obj*)CFISH_FALSE);
@@ -108,7 +108,7 @@ FullTextType_Dump_IMP(FullTextType *self) {
     FullTextTypeIVARS *const ivars = FullTextType_IVARS(self);
     Hash *dump = FullTextType_Dump_For_Schema(self);
     Hash_Store_Str(dump, "_class", 6,
-                   (Obj*)CB_Clone(FullTextType_Get_Class_Name(self)));
+                   (Obj*)Str_Clone(FullTextType_Get_Class_Name(self)));
     Hash_Store_Str(dump, "analyzer", 8,
                    (Obj*)Analyzer_Dump(ivars->analyzer));
     DECREF(Hash_Delete_Str(dump, "type", 4));
@@ -120,9 +120,9 @@ FullTextType*
 FullTextType_Load_IMP(FullTextType *self, Obj *dump) {
     UNUSED_VAR(self);
     Hash *source = (Hash*)CERTIFY(dump, HASH);
-    CharBuf *class_name = (CharBuf*)Hash_Fetch_Str(source, "_class", 6);
+    String *class_name = (String*)Hash_Fetch_Str(source, "_class", 6);
     VTable *vtable
-        = (class_name != NULL && Obj_Is_A((Obj*)class_name, CHARBUF))
+        = (class_name != NULL && Obj_Is_A((Obj*)class_name, STRING))
           ? VTable_singleton(class_name, NULL)
           : FULLTEXTTYPE;
     FullTextType *loaded = (FullTextType*)VTable_Make_Obj(vtable);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/NumericType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/NumericType.c b/core/Lucy/Plan/NumericType.c
index 6c26419..6ccda7d 100644
--- a/core/Lucy/Plan/NumericType.c
+++ b/core/Lucy/Plan/NumericType.c
@@ -50,7 +50,7 @@ NumType_Dump_For_Schema_IMP(NumericType *self) {
 
     // Store attributes that override the defaults.
     if (ivars->boost != 1.0) {
-        Hash_Store_Str(dump, "boost", 5, (Obj*)CB_newf("%f64", ivars->boost));
+        Hash_Store_Str(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
     }
     if (!ivars->indexed) {
         Hash_Store_Str(dump, "indexed", 7, (Obj*)CFISH_FALSE);
@@ -69,7 +69,7 @@ Hash*
 NumType_Dump_IMP(NumericType *self) {
     Hash *dump = NumType_Dump_For_Schema(self);
     Hash_Store_Str(dump, "_class", 6,
-                   (Obj*)CB_Clone(NumType_Get_Class_Name(self)));
+                   (Obj*)Str_Clone(NumType_Get_Class_Name(self)));
     DECREF(Hash_Delete_Str(dump, "type", 4));
     return dump;
 }
@@ -80,23 +80,23 @@ NumType_Load_IMP(NumericType *self, Obj *dump) {
     Hash *source = (Hash*)CERTIFY(dump, HASH);
 
     // Get a VTable
-    CharBuf *class_name = (CharBuf*)Hash_Fetch_Str(source, "_class", 6);
-    CharBuf *type_spec  = (CharBuf*)Hash_Fetch_Str(source, "type", 4);
+    String *class_name = (String*)Hash_Fetch_Str(source, "_class", 6);
+    String *type_spec  = (String*)Hash_Fetch_Str(source, "type", 4);
     VTable *vtable = NULL;
-    if (class_name != NULL && Obj_Is_A((Obj*)class_name, CHARBUF)) {
+    if (class_name != NULL && Obj_Is_A((Obj*)class_name, STRING)) {
         vtable = VTable_singleton(class_name, NULL);
     }
-    else if (type_spec != NULL && Obj_Is_A((Obj*)type_spec, CHARBUF)) {
-        if (CB_Equals_Str(type_spec, "i32_t", 5)) {
+    else if (type_spec != NULL && Obj_Is_A((Obj*)type_spec, STRING)) {
+        if (Str_Equals_Str(type_spec, "i32_t", 5)) {
             vtable = INT32TYPE;
         }
-        else if (CB_Equals_Str(type_spec, "i64_t", 5)) {
+        else if (Str_Equals_Str(type_spec, "i64_t", 5)) {
             vtable = INT64TYPE;
         }
-        else if (CB_Equals_Str(type_spec, "f32_t", 5)) {
+        else if (Str_Equals_Str(type_spec, "f32_t", 5)) {
             vtable = FLOAT32TYPE;
         }
-        else if (CB_Equals_Str(type_spec, "f64_t", 5)) {
+        else if (Str_Equals_Str(type_spec, "f64_t", 5)) {
             vtable = FLOAT64TYPE;
         }
         else {
@@ -141,10 +141,10 @@ Float64Type_init2(Float64Type *self, float boost, bool indexed,
                                        stored, sortable);
 }
 
-CharBuf*
+String*
 Float64Type_Specifier_IMP(Float64Type *self) {
     UNUSED_VAR(self);
-    return CB_newf("f64_t");
+    return Str_newf("f64_t");
 }
 
 int8_t
@@ -183,10 +183,10 @@ Float32Type_init2(Float32Type *self, float boost, bool indexed,
                                        stored, sortable);
 }
 
-CharBuf*
+String*
 Float32Type_Specifier_IMP(Float32Type *self) {
     UNUSED_VAR(self);
-    return CB_newf("f32_t");
+    return Str_newf("f32_t");
 }
 
 int8_t
@@ -225,10 +225,10 @@ Int32Type_init2(Int32Type *self, float boost, bool indexed,
                                      stored, sortable);
 }
 
-CharBuf*
+String*
 Int32Type_Specifier_IMP(Int32Type *self) {
     UNUSED_VAR(self);
-    return CB_newf("i32_t");
+    return Str_newf("i32_t");
 }
 
 int8_t
@@ -267,10 +267,10 @@ Int64Type_init2(Int64Type *self, float boost, bool indexed,
                                      stored, sortable);
 }
 
-CharBuf*
+String*
 Int64Type_Specifier_IMP(Int64Type *self) {
     UNUSED_VAR(self);
-    return CB_newf("i64_t");
+    return Str_newf("i64_t");
 }
 
 int8_t

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/NumericType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/NumericType.cfh b/core/Lucy/Plan/NumericType.cfh
index 33c7216..5565341 100644
--- a/core/Lucy/Plan/NumericType.cfh
+++ b/core/Lucy/Plan/NumericType.cfh
@@ -33,7 +33,7 @@ class Lucy::Plan::NumericType cnick NumType inherits Lucy::Plan::FieldType {
     /** Return the primitive type specifier for the object type, e.g.
      * f64_t for Float64, uint32_t for UInteger32, etc.
      */
-    abstract incremented CharBuf*
+    abstract incremented String*
     Specifier(NumericType *self);
 
     incremented Hash*
@@ -63,7 +63,7 @@ class Lucy::Plan::Float64Type inherits Lucy::Plan::FloatType {
     int8_t
     Primitive_ID(Float64Type *self);
 
-    incremented CharBuf*
+    incremented String*
     Specifier(Float64Type *self);
 
     public bool
@@ -85,7 +85,7 @@ class Lucy::Plan::Float32Type inherits Lucy::Plan::FloatType {
     int8_t
     Primitive_ID(Float32Type *self);
 
-    incremented CharBuf*
+    incremented String*
     Specifier(Float32Type *self);
 
     public bool
@@ -109,7 +109,7 @@ class Lucy::Plan::Int32Type inherits Lucy::Plan::IntType {
     int8_t
     Primitive_ID(Int32Type *self);
 
-    incremented CharBuf*
+    incremented String*
     Specifier(Int32Type *self);
 
     public bool
@@ -131,7 +131,7 @@ class Lucy::Plan::Int64Type inherits Lucy::Plan::IntType {
     int8_t
     Primitive_ID(Int64Type *self);
 
-    incremented CharBuf*
+    incremented String*
     Specifier(Int64Type *self);
 
     public bool

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/Schema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c
index 16429b8..32a6ba2 100644
--- a/core/Lucy/Plan/Schema.c
+++ b/core/Lucy/Plan/Schema.c
@@ -38,13 +38,13 @@ static void
 S_add_unique(VArray *array, Obj *elem);
 
 static void
-S_add_text_field(Schema *self, const CharBuf *field, FieldType *type);
+S_add_text_field(Schema *self, const String *field, FieldType *type);
 static void
-S_add_string_field(Schema *self, const CharBuf *field, FieldType *type);
+S_add_string_field(Schema *self, const String *field, FieldType *type);
 static void
-S_add_blob_field(Schema *self, const CharBuf *field, FieldType *type);
+S_add_blob_field(Schema *self, const String *field, FieldType *type);
 static void
-S_add_numeric_field(Schema *self, const CharBuf *field, FieldType *type);
+S_add_numeric_field(Schema *self, const String *field, FieldType *type);
 
 Schema*
 Schema_new() {
@@ -114,7 +114,7 @@ Schema_Architecture_IMP(Schema *self) {
 }
 
 void
-Schema_Spec_Field_IMP(Schema *self, const CharBuf *field, FieldType *type) {
+Schema_Spec_Field_IMP(Schema *self, const String *field, FieldType *type) {
     FieldType *existing  = Schema_Fetch_Type(self, field);
 
     // If the field already has an association, verify pairing and return.
@@ -141,7 +141,7 @@ Schema_Spec_Field_IMP(Schema *self, const CharBuf *field, FieldType *type) {
 }
 
 static void
-S_add_text_field(Schema *self, const CharBuf *field, FieldType *type) {
+S_add_text_field(Schema *self, const String *field, FieldType *type) {
     SchemaIVARS *const ivars = Schema_IVARS(self);
     FullTextType *fttype    = (FullTextType*)CERTIFY(type, FULLTEXTTYPE);
     Similarity   *sim       = FullTextType_Make_Similarity(fttype);
@@ -157,7 +157,7 @@ S_add_text_field(Schema *self, const CharBuf *field, FieldType *type) {
 }
 
 static void
-S_add_string_field(Schema *self, const CharBuf *field, FieldType *type) {
+S_add_string_field(Schema *self, const String *field, FieldType *type) {
     SchemaIVARS *const ivars = Schema_IVARS(self);
     StringType *string_type = (StringType*)CERTIFY(type, STRINGTYPE);
     Similarity *sim         = StringType_Make_Similarity(string_type);
@@ -170,27 +170,27 @@ S_add_string_field(Schema *self, const CharBuf *field, FieldType *type) {
 }
 
 static void
-S_add_blob_field(Schema *self, const CharBuf *field, FieldType *type) {
+S_add_blob_field(Schema *self, const String *field, FieldType *type) {
     SchemaIVARS *const ivars = Schema_IVARS(self);
     BlobType *blob_type = (BlobType*)CERTIFY(type, BLOBTYPE);
     Hash_Store(ivars->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 String *field, FieldType *type) {
     SchemaIVARS *const ivars = Schema_IVARS(self);
     NumericType *num_type = (NumericType*)CERTIFY(type, NUMERICTYPE);
     Hash_Store(ivars->types, (Obj*)field, INCREF(num_type));
 }
 
 FieldType*
-Schema_Fetch_Type_IMP(Schema *self, const CharBuf *field) {
+Schema_Fetch_Type_IMP(Schema *self, const String *field) {
     SchemaIVARS *const ivars = Schema_IVARS(self);
     return (FieldType*)Hash_Fetch(ivars->types, (Obj*)field);
 }
 
 Analyzer*
-Schema_Fetch_Analyzer_IMP(Schema *self, const CharBuf *field) {
+Schema_Fetch_Analyzer_IMP(Schema *self, const String *field) {
     SchemaIVARS *const ivars = Schema_IVARS(self);
     return field
            ? (Analyzer*)Hash_Fetch(ivars->analyzers, (Obj*)field)
@@ -198,7 +198,7 @@ Schema_Fetch_Analyzer_IMP(Schema *self, const CharBuf *field) {
 }
 
 Similarity*
-Schema_Fetch_Sim_IMP(Schema *self, const CharBuf *field) {
+Schema_Fetch_Sim_IMP(Schema *self, const String *field) {
     SchemaIVARS *const ivars = Schema_IVARS(self);
     Similarity *sim = NULL;
     if (field != NULL) {
@@ -252,12 +252,12 @@ Schema_Dump_IMP(Schema *self) {
     SchemaIVARS *const ivars = Schema_IVARS(self);
     Hash *dump = Hash_new(0);
     Hash *type_dumps = Hash_new(Hash_Get_Size(ivars->types));
-    CharBuf *field;
+    String *field;
     FieldType *type;
 
     // Record class name, store dumps of unique Analyzers.
     Hash_Store_Str(dump, "_class", 6,
-                   (Obj*)CB_Clone(Schema_Get_Class_Name(self)));
+                   (Obj*)Str_Clone(Schema_Get_Class_Name(self)));
     Hash_Store_Str(dump, "analyzers", 9,
                    Freezer_dump((Obj*)ivars->uniq_analyzers));
 
@@ -277,7 +277,7 @@ Schema_Dump_IMP(Schema *self) {
 
             // Store the tick which references a unique analyzer.
             Hash_Store_Str(type_dump, "analyzer", 8,
-                           (Obj*)CB_newf("%u32", tick));
+                           (Obj*)Str_newf("%u32", tick));
 
             Hash_Store(type_dumps, (Obj*)field, (Obj*)type_dump);
         }
@@ -305,8 +305,8 @@ S_load_type(VTable *vtable, Obj *type_dump) {
 Schema*
 Schema_Load_IMP(Schema *self, Obj *dump) {
     Hash *source = (Hash*)CERTIFY(dump, HASH);
-    CharBuf *class_name
-        = (CharBuf*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), CHARBUF);
+    String *class_name
+        = (String*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), STRING);
     VTable *vtable = VTable_singleton(class_name, NULL);
     Schema *loaded = (Schema*)VTable_Make_Obj(vtable);
     Hash *type_dumps
@@ -315,7 +315,7 @@ Schema_Load_IMP(Schema *self, Obj *dump) {
         = (VArray*)CERTIFY(Hash_Fetch_Str(source, "analyzers", 9), VARRAY);
     VArray *analyzers
         = (VArray*)Freezer_load((Obj*)analyzer_dumps);
-    CharBuf *field;
+    String *field;
     Hash    *type_dump;
     UNUSED_VAR(self);
 
@@ -326,11 +326,11 @@ Schema_Load_IMP(Schema *self, Obj *dump) {
 
     Hash_Iterate(type_dumps);
     while (Hash_Next(type_dumps, (Obj**)&field, (Obj**)&type_dump)) {
-        CharBuf *type_str;
+        String *type_str;
         CERTIFY(type_dump, HASH);
-        type_str = (CharBuf*)Hash_Fetch_Str(type_dump, "type", 4);
+        type_str = (String*)Hash_Fetch_Str(type_dump, "type", 4);
         if (type_str) {
-            if (CB_Equals_Str(type_str, "fulltext", 8)) {
+            if (Str_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);
@@ -347,37 +347,37 @@ Schema_Load_IMP(Schema *self, Obj *dump) {
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
-            else if (CB_Equals_Str(type_str, "string", 6)) {
+            else if (Str_Equals_Str(type_str, "string", 6)) {
                 StringType *type
                     = (StringType*)S_load_type(STRINGTYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
-            else if (CB_Equals_Str(type_str, "blob", 4)) {
+            else if (Str_Equals_Str(type_str, "blob", 4)) {
                 BlobType *type
                     = (BlobType*)S_load_type(BLOBTYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
-            else if (CB_Equals_Str(type_str, "i32_t", 5)) {
+            else if (Str_Equals_Str(type_str, "i32_t", 5)) {
                 Int32Type *type
                     = (Int32Type*)S_load_type(INT32TYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
-            else if (CB_Equals_Str(type_str, "i64_t", 5)) {
+            else if (Str_Equals_Str(type_str, "i64_t", 5)) {
                 Int64Type *type
                     = (Int64Type*)S_load_type(INT64TYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
-            else if (CB_Equals_Str(type_str, "f32_t", 5)) {
+            else if (Str_Equals_Str(type_str, "f32_t", 5)) {
                 Float32Type *type
                     = (Float32Type*)S_load_type(FLOAT32TYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
                 DECREF(type);
             }
-            else if (CB_Equals_Str(type_str, "f64_t", 5)) {
+            else if (Str_Equals_Str(type_str, "f64_t", 5)) {
                 Float64Type *type
                     = (Float64Type*)S_load_type(FLOAT64TYPE, (Obj*)type_dump);
                 Schema_Spec_Field(loaded, field, (FieldType*)type);
@@ -408,7 +408,7 @@ Schema_Eat_IMP(Schema *self, Schema *other) {
               Schema_Get_Class_Name(self), Schema_Get_Class_Name(other));
     }
 
-    CharBuf *field;
+    String *field;
     FieldType *type;
     SchemaIVARS *const ovars = Schema_IVARS(other);
     Hash_Iterate(ovars->types);
@@ -418,13 +418,13 @@ Schema_Eat_IMP(Schema *self, Schema *other) {
 }
 
 void
-Schema_Write_IMP(Schema *self, Folder *folder, const CharBuf *filename) {
+Schema_Write_IMP(Schema *self, Folder *folder, const String *filename) {
     Hash *dump = Schema_Dump(self);
     StackString *schema_temp = SSTR_WRAP_STR("schema.temp", 11);
     bool success;
-    Folder_Delete(folder, (CharBuf*)schema_temp); // Just in case.
-    Json_spew_json((Obj*)dump, folder, (CharBuf*)schema_temp);
-    success = Folder_Rename(folder, (CharBuf*)schema_temp, filename);
+    Folder_Delete(folder, (String*)schema_temp); // Just in case.
+    Json_spew_json((Obj*)dump, folder, (String*)schema_temp);
+    success = Folder_Rename(folder, (String*)schema_temp, filename);
     DECREF(dump);
     if (!success) { RETHROW(INCREF(Err_get_error())); }
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/Schema.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.cfh b/core/Lucy/Plan/Schema.cfh
index 8f0df6d..527b68f 100644
--- a/core/Lucy/Plan/Schema.cfh
+++ b/core/Lucy/Plan/Schema.cfh
@@ -57,24 +57,24 @@ public class Lucy::Plan::Schema inherits Clownfish::Obj {
      * @param type A FieldType.
      */
     public void
-    Spec_Field(Schema *self, const CharBuf *name, FieldType *type);
+    Spec_Field(Schema *self, const String *name, FieldType *type);
 
     /** Return the FieldType for the specified field.  If the field can't be
      * found, return NULL.
      */
     public nullable FieldType*
-    Fetch_Type(Schema *self, const CharBuf *field);
+    Fetch_Type(Schema *self, const String *field);
 
     /** Return the Analyzer for the specified field.
      */
     nullable Analyzer*
-    Fetch_Analyzer(Schema *self, const CharBuf *field = NULL);
+    Fetch_Analyzer(Schema *self, const String *field = NULL);
 
     /** Return the Similarity for the specified field, or NULL if either the
      * field can't be found or it isn't associated with a Similarity.
      */
     public nullable Similarity*
-    Fetch_Sim(Schema *self, const CharBuf *field = NULL);
+    Fetch_Sim(Schema *self, const String *field = NULL);
 
     /** Return the number of fields currently defined.
      */
@@ -108,7 +108,7 @@ public class Lucy::Plan::Schema inherits Clownfish::Obj {
     Eat(Schema *self, Schema *other);
 
     void
-    Write(Schema *self, Folder *folder, const CharBuf *filename = NULL);
+    Write(Schema *self, Folder *folder, const String *filename = NULL);
 
     public void
     Destroy(Schema *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/StringType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/StringType.c b/core/Lucy/Plan/StringType.c
index a6b2f7f..e87045e 100644
--- a/core/Lucy/Plan/StringType.c
+++ b/core/Lucy/Plan/StringType.c
@@ -58,11 +58,11 @@ Hash*
 StringType_Dump_For_Schema_IMP(StringType *self) {
     StringTypeIVARS *const ivars = StringType_IVARS(self);
     Hash *dump = Hash_new(0);
-    Hash_Store_Str(dump, "type", 4, (Obj*)CB_newf("string"));
+    Hash_Store_Str(dump, "type", 4, (Obj*)Str_newf("string"));
 
     // Store attributes that override the defaults.
     if (ivars->boost != 1.0) {
-        Hash_Store_Str(dump, "boost", 5, (Obj*)CB_newf("%f64", ivars->boost));
+        Hash_Store_Str(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
     }
     if (!ivars->indexed) {
         Hash_Store_Str(dump, "indexed", 7, (Obj*)CFISH_FALSE);
@@ -81,7 +81,7 @@ Hash*
 StringType_Dump_IMP(StringType *self) {
     Hash *dump = StringType_Dump_For_Schema(self);
     Hash_Store_Str(dump, "_class", 6,
-                   (Obj*)CB_Clone(StringType_Get_Class_Name(self)));
+                   (Obj*)Str_Clone(StringType_Get_Class_Name(self)));
     DECREF(Hash_Delete_Str(dump, "type", 4));
     return dump;
 }
@@ -89,9 +89,9 @@ StringType_Dump_IMP(StringType *self) {
 StringType*
 StringType_Load_IMP(StringType *self, Obj *dump) {
     Hash *source = (Hash*)CERTIFY(dump, HASH);
-    CharBuf *class_name = (CharBuf*)Hash_Fetch_Str(source, "_class", 6);
+    String *class_name = (String*)Hash_Fetch_Str(source, "_class", 6);
     VTable *vtable
-        = (class_name != NULL && Obj_Is_A((Obj*)class_name, CHARBUF))
+        = (class_name != NULL && Obj_Is_A((Obj*)class_name, STRING))
           ? VTable_singleton(class_name, NULL)
           : STRINGTYPE;
     StringType *loaded   = (StringType*)VTable_Make_Obj(vtable);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/TextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.c b/core/Lucy/Plan/TextType.c
index 599673a..a602eb0 100644
--- a/core/Lucy/Plan/TextType.c
+++ b/core/Lucy/Plan/TextType.c
@@ -23,10 +23,10 @@
 #include "Lucy/Store/OutStream.h"
 #include "Clownfish/Util/StringHelper.h"
 
-CharBuf*
+String*
 TextType_Make_Blank_IMP(TextType *self) {
     UNUSED_VAR(self);
-    return CB_new(0);
+    return Str_new(0);
 }
 
 TermStepper*
@@ -54,14 +54,14 @@ TextTermStepper*
 TextTermStepper_init(TextTermStepper *self) {
     TermStepper_init((TermStepper*)self);
     TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
-    ivars->value = (Obj*)CB_new(0);
+    ivars->value = (Obj*)Str_new(0);
     return self;
 }
 
 void
 TextTermStepper_Set_Value_IMP(TextTermStepper *self, Obj *value) {
     TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
-    CERTIFY(value, CHARBUF);
+    CERTIFY(value, STRING);
     DECREF(ivars->value);
     ivars->value = INCREF(value);
 }
@@ -69,15 +69,15 @@ TextTermStepper_Set_Value_IMP(TextTermStepper *self, Obj *value) {
 void
 TextTermStepper_Reset_IMP(TextTermStepper *self) {
     TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
-    CB_Set_Size((CharBuf*)ivars->value, 0);
+    Str_Set_Size((String*)ivars->value, 0);
 }
 
 void
 TextTermStepper_Write_Key_Frame_IMP(TextTermStepper *self,
                                     OutStream *outstream, Obj *value) {
     TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
-    uint8_t *buf  = CB_Get_Ptr8((CharBuf*)value);
-    size_t   size = CB_Get_Size((CharBuf*)value);
+    uint8_t *buf  = Str_Get_Ptr8((String*)value);
+    size_t   size = Str_Get_Size((String*)value);
     OutStream_Write_C32(outstream, size);
     OutStream_Write_Bytes(outstream, buf, size);
     Obj_Mimic(ivars->value, value);
@@ -87,12 +87,12 @@ void
 TextTermStepper_Write_Delta_IMP(TextTermStepper *self, OutStream *outstream,
                                 Obj *value) {
     TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
-    CharBuf *new_value  = (CharBuf*)CERTIFY(value, CHARBUF);
-    CharBuf *last_value = (CharBuf*)ivars->value;
-    char    *new_text  = (char*)CB_Get_Ptr8(new_value);
-    size_t   new_size  = CB_Get_Size(new_value);
-    char    *last_text = (char*)CB_Get_Ptr8(last_value);
-    size_t   last_size = CB_Get_Size(last_value);
+    String *new_value  = (String*)CERTIFY(value, STRING);
+    String *last_value = (String*)ivars->value;
+    char    *new_text  = (char*)Str_Get_Ptr8(new_value);
+    size_t   new_size  = Str_Get_Size(new_value);
+    char    *last_text = (char*)Str_Get_Ptr8(last_value);
+    size_t   last_size = Str_Get_Size(last_value);
 
     // Count how many bytes the strings share at the top.
     const int32_t overlap = StrHelp_overlap(last_text, new_text,
@@ -105,7 +105,7 @@ TextTermStepper_Write_Delta_IMP(TextTermStepper *self, OutStream *outstream,
     OutStream_Write_String(outstream, diff_start_str, diff_len);
 
     // Update value.
-    CB_Mimic((CharBuf*)ivars->value, value);
+    Str_Mimic((String*)ivars->value, value);
 }
 
 void
@@ -116,14 +116,14 @@ TextTermStepper_Read_Key_Frame_IMP(TextTermStepper *self,
 
     // Allocate space.
     if (ivars->value == NULL) {
-        ivars->value = (Obj*)CB_new(text_len);
+        ivars->value = (Obj*)Str_new(text_len);
     }
-    CharBuf *value = (CharBuf*)ivars->value;
-    char *ptr      = CB_Grow(value, text_len);
+    String *value = (String*)ivars->value;
+    char *ptr      = Str_Grow(value, text_len);
 
     // Set the value text.
     InStream_Read_Bytes(instream, ptr, text_len);
-    CB_Set_Size(value, text_len);
+    Str_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),
@@ -143,14 +143,14 @@ TextTermStepper_Read_Delta_IMP(TextTermStepper *self, InStream *instream) {
 
     // Allocate space.
     if (ivars->value == NULL) {
-        ivars->value = (Obj*)CB_new(total_text_len);
+        ivars->value = (Obj*)Str_new(total_text_len);
     }
-    CharBuf *value = (CharBuf*)ivars->value;
-    char *ptr      = CB_Grow(value, total_text_len);
+    String *value = (String*)ivars->value;
+    char *ptr      = Str_Grow(value, total_text_len);
 
     // Set the value text.
     InStream_Read_Bytes(instream, ptr + text_overlap, finish_chars_len);
-    CB_Set_Size(value, total_text_len);
+    Str_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),

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Plan/TextType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.cfh b/core/Lucy/Plan/TextType.cfh
index 33cdc17..0bcc3cc 100644
--- a/core/Lucy/Plan/TextType.cfh
+++ b/core/Lucy/Plan/TextType.cfh
@@ -17,7 +17,7 @@
 parcel Lucy;
 
 class Lucy::Plan::TextType inherits Lucy::Plan::FieldType {
-    incremented CharBuf*
+    incremented String*
     Make_Blank(TextType *self);
 
     incremented TermStepper*
@@ -40,7 +40,7 @@ class Lucy::Index::TermStepper::TextTermStepper
     Reset(TextTermStepper *self);
 
     /**
-     * @param value A CharBuf.
+     * @param value A String.
      */
     public void
     Set_Value(TextTermStepper *self, Obj *value = NULL);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/ANDQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ANDQuery.c b/core/Lucy/Search/ANDQuery.c
index 0b06785..b23f4f5 100644
--- a/core/Lucy/Search/ANDQuery.c
+++ b/core/Lucy/Search/ANDQuery.c
@@ -41,22 +41,22 @@ ANDQuery_init(ANDQuery *self, VArray *children) {
     return (ANDQuery*)PolyQuery_init((PolyQuery*)self, children);
 }
 
-CharBuf*
+String*
 ANDQuery_To_String_IMP(ANDQuery *self) {
     ANDQueryIVARS *const ivars = ANDQuery_IVARS(self);
     uint32_t num_kids = VA_Get_Size(ivars->children);
-    if (!num_kids) { return CB_new_from_trusted_utf8("()", 2); }
+    if (!num_kids) { return Str_new_from_trusted_utf8("()", 2); }
     else {
-        CharBuf *retval = CB_new_from_trusted_utf8("(", 1);
+        String *retval = Str_new_from_trusted_utf8("(", 1);
         for (uint32_t i = 0; i < num_kids; i++) {
-            CharBuf *kid_string = Obj_To_String(VA_Fetch(ivars->children, i));
-            CB_Cat(retval, kid_string);
+            String *kid_string = Obj_To_String(VA_Fetch(ivars->children, i));
+            Str_Cat(retval, kid_string);
             DECREF(kid_string);
             if (i == num_kids - 1) {
-                CB_Cat_Trusted_Str(retval, ")", 1);
+                Str_Cat_Trusted_Str(retval, ")", 1);
             }
             else {
-                CB_Cat_Trusted_Str(retval, " AND ", 5);
+                Str_Cat_Trusted_Str(retval, " AND ", 5);
             }
         }
         return retval;

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/ANDQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ANDQuery.cfh b/core/Lucy/Search/ANDQuery.cfh
index f17eeda..0c2e94a 100644
--- a/core/Lucy/Search/ANDQuery.cfh
+++ b/core/Lucy/Search/ANDQuery.cfh
@@ -37,7 +37,7 @@ public class Lucy::Search::ANDQuery inherits Lucy::Search::PolyQuery {
     Make_Compiler(ANDQuery *self, Searcher *searcher, float boost,
                   bool subordinate = false);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(ANDQuery *self);
 
     public bool

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/Collector/SortCollector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Collector/SortCollector.c b/core/Lucy/Search/Collector/SortCollector.c
index 63d0989..15e9480 100644
--- a/core/Lucy/Search/Collector/SortCollector.c
+++ b/core/Lucy/Search/Collector/SortCollector.c
@@ -128,7 +128,7 @@ SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec,
             ivars->need_score = true;
         }
         else if (rule_type == SortRule_FIELD) {
-            CharBuf *field = SortRule_Get_Field(rule);
+            String *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);
@@ -239,7 +239,7 @@ SortColl_Set_Reader_IMP(SortCollector *self, SegReader *reader) {
     if (ivars->need_values && sort_reader) {
         for (uint32_t i = 0, max = ivars->num_rules; i < max; i++) {
             SortRule  *rule  = (SortRule*)VA_Fetch(ivars->rules, i);
-            CharBuf   *field = SortRule_Get_Field(rule);
+            String    *field = SortRule_Get_Field(rule);
             SortCache *cache = field
                                ? SortReader_Fetch_Sort_Cache(sort_reader, field)
                                : NULL;

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/Compiler.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Compiler.c b/core/Lucy/Search/Compiler.c
index bc434e1..1b82cb7 100644
--- a/core/Lucy/Search/Compiler.c
+++ b/core/Lucy/Search/Compiler.c
@@ -95,7 +95,7 @@ Compiler_Normalize_IMP(Compiler *self) {
 
 VArray*
 Compiler_Highlight_Spans_IMP(Compiler *self, Searcher *searcher,
-                             DocVector *doc_vec, const CharBuf *field) {
+                             DocVector *doc_vec, const String *field) {
     UNUSED_VAR(self);
     UNUSED_VAR(searcher);
     UNUSED_VAR(doc_vec);
@@ -103,13 +103,13 @@ Compiler_Highlight_Spans_IMP(Compiler *self, Searcher *searcher,
     return VA_new(0);
 }
 
-CharBuf*
+String*
 Compiler_To_String_IMP(Compiler *self) {
     CompilerIVARS *const ivars = Compiler_IVARS(self);
-    CharBuf *stringified_query = Query_To_String(ivars->parent);
-    CharBuf *string = CB_new_from_trusted_utf8("compiler(", 9);
-    CB_Cat(string, stringified_query);
-    CB_Cat_Trusted_Str(string, ")", 1);
+    String *stringified_query = Query_To_String(ivars->parent);
+    String *string = Str_new_from_trusted_utf8("compiler(", 9);
+    Str_Cat(string, stringified_query);
+    Str_Cat_Trusted_Str(string, ")", 1);
     DECREF(stringified_query);
     return string;
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/Compiler.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Compiler.cfh b/core/Lucy/Search/Compiler.cfh
index 910e708..8a1144f 100644
--- a/core/Lucy/Search/Compiler.cfh
+++ b/core/Lucy/Search/Compiler.cfh
@@ -149,7 +149,7 @@ public class Lucy::Search::Compiler inherits Lucy::Search::Query {
      */
     public incremented VArray*
     Highlight_Spans(Compiler *self, Searcher *searcher,
-                    DocVector *doc_vec, const CharBuf *field);
+                    DocVector *doc_vec, const String *field);
 
     public void
     Serialize(Compiler *self, OutStream *outstream);
@@ -160,7 +160,7 @@ public class Lucy::Search::Compiler inherits Lucy::Search::Query {
     public bool
     Equals(Compiler *self, Obj *other);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(Compiler *self);
 
     public void

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/HitQueue.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/HitQueue.c b/core/Lucy/Search/HitQueue.c
index 97b920e..fb32c1d 100644
--- a/core/Lucy/Search/HitQueue.c
+++ b/core/Lucy/Search/HitQueue.c
@@ -76,7 +76,7 @@ HitQ_init(HitQueue *self, Schema *schema, SortSpec *sort_spec,
                                               : COMPARE_BY_DOC_ID;
             }
             else if (rule_type == SortRule_FIELD) {
-                CharBuf   *field = SortRule_Get_Field(rule);
+                String    *field = SortRule_Get_Field(rule);
                 FieldType *type  = Schema_Fetch_Type(schema, field);
                 if (type) {
                     ivars->field_types[action_num] = (FieldType*)INCREF(type);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/IndexSearcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/IndexSearcher.c b/core/Lucy/Search/IndexSearcher.c
index 88d2b7a..dc4fc0d 100644
--- a/core/Lucy/Search/IndexSearcher.c
+++ b/core/Lucy/Search/IndexSearcher.c
@@ -103,7 +103,7 @@ IxSearcher_Doc_Max_IMP(IndexSearcher *self) {
 }
 
 uint32_t
-IxSearcher_Doc_Freq_IMP(IndexSearcher *self, const CharBuf *field, Obj *term) {
+IxSearcher_Doc_Freq_IMP(IndexSearcher *self, const String *field, Obj *term) {
     IndexSearcherIVARS *const ivars = IxSearcher_IVARS(self);
     LexiconReader *lex_reader
         = (LexiconReader*)IxReader_Fetch(ivars->reader,

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/IndexSearcher.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/IndexSearcher.cfh b/core/Lucy/Search/IndexSearcher.cfh
index b5381c6..fce1910 100644
--- a/core/Lucy/Search/IndexSearcher.cfh
+++ b/core/Lucy/Search/IndexSearcher.cfh
@@ -51,7 +51,7 @@ public class Lucy::Search::IndexSearcher cnick IxSearcher
     Doc_Max(IndexSearcher *self);
 
     public uint32_t
-    Doc_Freq(IndexSearcher *self, const CharBuf *field, Obj *term);
+    Doc_Freq(IndexSearcher *self, const String *field, Obj *term);
 
     public void
     Collect(IndexSearcher *self, Query *query, Collector *collector);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/LeafQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.c b/core/Lucy/Search/LeafQuery.c
index 3901b43..488130f 100644
--- a/core/Lucy/Search/LeafQuery.c
+++ b/core/Lucy/Search/LeafQuery.c
@@ -25,17 +25,17 @@
 #include "Lucy/Util/Freezer.h"
 
 LeafQuery*
-LeafQuery_new(const CharBuf *field, const CharBuf *text) {
+LeafQuery_new(const String *field, const String *text) {
     LeafQuery *self = (LeafQuery*)VTable_Make_Obj(LEAFQUERY);
     return LeafQuery_init(self, field, text);
 }
 
 LeafQuery*
-LeafQuery_init(LeafQuery *self, const CharBuf *field, const CharBuf *text) {
+LeafQuery_init(LeafQuery *self, const String *field, const String *text) {
     LeafQueryIVARS *const ivars = LeafQuery_IVARS(self);
     Query_init((Query*)self, 1.0f);
-    ivars->field       = field ? CB_Clone(field) : NULL;
-    ivars->text        = CB_Clone(text);
+    ivars->field       = field ? Str_Clone(field) : NULL;
+    ivars->text        = Str_Clone(text);
     return self;
 }
 
@@ -47,12 +47,12 @@ LeafQuery_Destroy_IMP(LeafQuery *self) {
     SUPER_DESTROY(self, LEAFQUERY);
 }
 
-CharBuf*
+String*
 LeafQuery_Get_Field_IMP(LeafQuery *self) {
     return LeafQuery_IVARS(self)->field;
 }
 
-CharBuf*
+String*
 LeafQuery_Get_Text_IMP(LeafQuery *self) {
     return LeafQuery_IVARS(self)->text;
 }
@@ -66,20 +66,20 @@ LeafQuery_Equals_IMP(LeafQuery *self, Obj *other) {
     if (ivars->boost != ovars->boost)    { return false; }
     if (!!ivars->field ^ !!ovars->field) { return false; }
     if (ivars->field) {
-        if (!CB_Equals(ivars->field, (Obj*)ovars->field)) { return false; }
+        if (!Str_Equals(ivars->field, (Obj*)ovars->field)) { return false; }
     }
-    if (!CB_Equals(ivars->text, (Obj*)ovars->text)) { return false; }
+    if (!Str_Equals(ivars->text, (Obj*)ovars->text)) { return false; }
     return true;
 }
 
-CharBuf*
+String*
 LeafQuery_To_String_IMP(LeafQuery *self) {
     LeafQueryIVARS *const ivars = LeafQuery_IVARS(self);
     if (ivars->field) {
-        return CB_newf("%o:%o", ivars->field, ivars->text);
+        return Str_newf("%o:%o", ivars->field, ivars->text);
     }
     else {
-        return CB_Clone(ivars->text);
+        return Str_Clone(ivars->text);
     }
 }
 
@@ -134,10 +134,10 @@ LeafQuery_Load_IMP(LeafQuery *self, Obj *dump) {
     Obj *field = Hash_Fetch_Str(source, "field", 5);
     if (field) {
         loaded_ivars->field
-            = (CharBuf*)CERTIFY(Freezer_load(field), CHARBUF);
+            = (String*)CERTIFY(Freezer_load(field), STRING);
     }
     Obj *text = CERTIFY(Hash_Fetch_Str(source, "text", 4), OBJ);
-    loaded_ivars->text = (CharBuf*)CERTIFY(Freezer_load(text), CHARBUF);
+    loaded_ivars->text = (String*)CERTIFY(Freezer_load(text), STRING);
     return (Obj*)loaded;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/LeafQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.cfh b/core/Lucy/Search/LeafQuery.cfh
index a5ac359..4c7d09c 100644
--- a/core/Lucy/Search/LeafQuery.cfh
+++ b/core/Lucy/Search/LeafQuery.cfh
@@ -27,33 +27,33 @@ parcel Lucy;
  */
 public class Lucy::Search::LeafQuery inherits Lucy::Search::Query {
 
-    CharBuf *field;
-    CharBuf *text;
+    String *field;
+    String *text;
 
     inert incremented LeafQuery*
-    new(const CharBuf *field = NULL, const CharBuf *text);
+    new(const String *field = NULL, const String *text);
 
     /**
      * @param field Optional field name.
      * @param text Raw query text.
      */
     public inert LeafQuery*
-    init(LeafQuery *self, const CharBuf *field = NULL, const CharBuf *text);
+    init(LeafQuery *self, const String *field = NULL, const String *text);
 
     /** Accessor for object's <code>field</code> attribute.
      */
-    public nullable CharBuf*
+    public nullable String*
     Get_Field(LeafQuery *self);
 
     /** Accessor for object's <code>text</code> attribute.
      */
-    public CharBuf*
+    public String*
     Get_Text(LeafQuery *self);
 
     public bool
     Equals(LeafQuery *self, Obj *other);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(LeafQuery *self);
 
     public void

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/MatchAllQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/MatchAllQuery.c b/core/Lucy/Search/MatchAllQuery.c
index 73d2ed3..2028e39 100644
--- a/core/Lucy/Search/MatchAllQuery.c
+++ b/core/Lucy/Search/MatchAllQuery.c
@@ -49,10 +49,10 @@ MatchAllQuery_Equals_IMP(MatchAllQuery *self, Obj *other) {
     return true;
 }
 
-CharBuf*
+String*
 MatchAllQuery_To_String_IMP(MatchAllQuery *self) {
     UNUSED_VAR(self);
-    return CB_new_from_trusted_utf8("[MATCHALL]", 10);
+    return Str_new_from_trusted_utf8("[MATCHALL]", 10);
 }
 
 Compiler*

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/MatchAllQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/MatchAllQuery.cfh b/core/Lucy/Search/MatchAllQuery.cfh
index bdbbc72..3e4295d 100644
--- a/core/Lucy/Search/MatchAllQuery.cfh
+++ b/core/Lucy/Search/MatchAllQuery.cfh
@@ -36,7 +36,7 @@ public class Lucy::Search::MatchAllQuery inherits Lucy::Search::Query {
     public bool
     Equals(MatchAllQuery *self, Obj *other);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(MatchAllQuery *self);
 
     public incremented Compiler*

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/NOTQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NOTQuery.c b/core/Lucy/Search/NOTQuery.c
index d328f61..eb9baf4 100644
--- a/core/Lucy/Search/NOTQuery.c
+++ b/core/Lucy/Search/NOTQuery.c
@@ -53,11 +53,11 @@ NOTQuery_Set_Negated_Query_IMP(NOTQuery *self, Query *negated_query) {
     VA_Store(ivars->children, 0, INCREF(negated_query));
 }
 
-CharBuf*
+String*
 NOTQuery_To_String_IMP(NOTQuery *self) {
     NOTQueryIVARS *const ivars = NOTQuery_IVARS(self);
-    CharBuf *neg_string = Obj_To_String(VA_Fetch(ivars->children, 0));
-    CharBuf *retval = CB_newf("-%o", neg_string);
+    String *neg_string = Obj_To_String(VA_Fetch(ivars->children, 0));
+    String *retval = Str_newf("-%o", neg_string);
     DECREF(neg_string);
     return retval;
 }
@@ -105,7 +105,7 @@ NOTCompiler_Sum_Of_Squared_Weights_IMP(NOTCompiler *self) {
 
 VArray*
 NOTCompiler_Highlight_Spans_IMP(NOTCompiler *self, Searcher *searcher,
-                                DocVector *doc_vec, const CharBuf *field) {
+                                DocVector *doc_vec, const String *field) {
     UNUSED_VAR(self);
     UNUSED_VAR(searcher);
     UNUSED_VAR(doc_vec);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/NOTQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NOTQuery.cfh b/core/Lucy/Search/NOTQuery.cfh
index 66f8eb8..8e38d85 100644
--- a/core/Lucy/Search/NOTQuery.cfh
+++ b/core/Lucy/Search/NOTQuery.cfh
@@ -53,7 +53,7 @@ public class Lucy::Search::NOTQuery inherits Lucy::Search::PolyQuery {
     Make_Compiler(NOTQuery *self, Searcher *searcher, float boost,
                   bool subordinate = false);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(NOTQuery *self);
 
     public bool
@@ -78,7 +78,7 @@ class Lucy::Search::NOTCompiler
 
     public incremented VArray*
     Highlight_Spans(NOTCompiler *self, Searcher *searcher,
-                    DocVector *doc_vec, const CharBuf *field);
+                    DocVector *doc_vec, const String *field);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/NoMatchQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NoMatchQuery.c b/core/Lucy/Search/NoMatchQuery.c
index 70f422f..b46d460 100644
--- a/core/Lucy/Search/NoMatchQuery.c
+++ b/core/Lucy/Search/NoMatchQuery.c
@@ -51,10 +51,10 @@ NoMatchQuery_Equals_IMP(NoMatchQuery *self, Obj *other) {
     return true;
 }
 
-CharBuf*
+String*
 NoMatchQuery_To_String_IMP(NoMatchQuery *self) {
     UNUSED_VAR(self);
-    return CB_new_from_trusted_utf8("[NOMATCH]", 9);
+    return Str_new_from_trusted_utf8("[NOMATCH]", 9);
 }
 
 Compiler*

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/NoMatchQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NoMatchQuery.cfh b/core/Lucy/Search/NoMatchQuery.cfh
index 3abfcc1..13a5bc5 100644
--- a/core/Lucy/Search/NoMatchQuery.cfh
+++ b/core/Lucy/Search/NoMatchQuery.cfh
@@ -56,7 +56,7 @@ public class Lucy::Search::NoMatchQuery inherits Lucy::Search::Query {
     public bool
     Equals(NoMatchQuery *self, Obj *other);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(NoMatchQuery *self);
 
     public incremented Compiler*

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/ORQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ORQuery.c b/core/Lucy/Search/ORQuery.c
index 61c0668..9d15704 100644
--- a/core/Lucy/Search/ORQuery.c
+++ b/core/Lucy/Search/ORQuery.c
@@ -56,23 +56,23 @@ ORQuery_Equals_IMP(ORQuery *self, Obj *other) {
     return super_equals(self, other);
 }
 
-CharBuf*
+String*
 ORQuery_To_String_IMP(ORQuery *self) {
     ORQueryIVARS *const ivars = ORQuery_IVARS(self);
     uint32_t num_kids = VA_Get_Size(ivars->children);
-    if (!num_kids) { return CB_new_from_trusted_utf8("()", 2); }
+    if (!num_kids) { return Str_new_from_trusted_utf8("()", 2); }
     else {
-        CharBuf *retval = CB_new_from_trusted_utf8("(", 1);
+        String *retval = Str_new_from_trusted_utf8("(", 1);
         uint32_t last_kid = num_kids - 1;
         for (uint32_t i = 0; i < num_kids; i++) {
-            CharBuf *kid_string = Obj_To_String(VA_Fetch(ivars->children, i));
-            CB_Cat(retval, kid_string);
+            String *kid_string = Obj_To_String(VA_Fetch(ivars->children, i));
+            Str_Cat(retval, kid_string);
             DECREF(kid_string);
             if (i == last_kid) {
-                CB_Cat_Trusted_Str(retval, ")", 1);
+                Str_Cat_Trusted_Str(retval, ")", 1);
             }
             else {
-                CB_Cat_Trusted_Str(retval, " OR ", 4);
+                Str_Cat_Trusted_Str(retval, " OR ", 4);
             }
         }
         return retval;

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/ORQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ORQuery.cfh b/core/Lucy/Search/ORQuery.cfh
index 5845c54..8fc5eb8 100644
--- a/core/Lucy/Search/ORQuery.cfh
+++ b/core/Lucy/Search/ORQuery.cfh
@@ -39,7 +39,7 @@ public class Lucy::Search::ORQuery inherits Lucy::Search::PolyQuery {
     Make_Compiler(ORQuery *self, Searcher *searcher, float boost,
                   bool subordinate = false);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(ORQuery *self);
 
     public bool

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index 4eac2d7..af94c00 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -41,17 +41,17 @@
 // Shared initialization routine which assumes that it's ok to assume control
 // over [field] and [terms], eating their refcounts.
 static PhraseQuery*
-S_do_init(PhraseQuery *self, CharBuf *field, VArray *terms, float boost);
+S_do_init(PhraseQuery *self, String *field, VArray *terms, float boost);
 
 PhraseQuery*
-PhraseQuery_new(const CharBuf *field, VArray *terms) {
+PhraseQuery_new(const String *field, VArray *terms) {
     PhraseQuery *self = (PhraseQuery*)VTable_Make_Obj(PHRASEQUERY);
     return PhraseQuery_init(self, field, terms);
 }
 
 PhraseQuery*
-PhraseQuery_init(PhraseQuery *self, const CharBuf *field, VArray *terms) {
-    return S_do_init(self, CB_Clone(field), VA_Clone(terms), 1.0f);
+PhraseQuery_init(PhraseQuery *self, const String *field, VArray *terms) {
+    return S_do_init(self, Str_Clone(field), VA_Clone(terms), 1.0f);
 }
 
 void
@@ -63,7 +63,7 @@ PhraseQuery_Destroy_IMP(PhraseQuery *self) {
 }
 
 static PhraseQuery*
-S_do_init(PhraseQuery *self, CharBuf *field, VArray *terms, float boost) {
+S_do_init(PhraseQuery *self, String *field, VArray *terms, float boost) {
     Query_init((Query*)self, boost);
     PhraseQueryIVARS *const ivars = PhraseQuery_IVARS(self);
     for (uint32_t i = 0, max = VA_Get_Size(terms); i < max; i++) {
@@ -85,7 +85,7 @@ PhraseQuery_Serialize_IMP(PhraseQuery *self, OutStream *outstream) {
 PhraseQuery*
 PhraseQuery_Deserialize_IMP(PhraseQuery *self, InStream *instream) {
     float boost = InStream_Read_F32(instream);
-    CharBuf *field = Freezer_read_charbuf(instream);
+    String *field = Freezer_read_charbuf(instream);
     VArray  *terms = Freezer_read_varray(instream);
     return S_do_init(self, field, terms, boost);
 }
@@ -110,7 +110,7 @@ PhraseQuery_Load_IMP(PhraseQuery *self, Obj *dump) {
     PhraseQueryIVARS *loaded_ivars = PhraseQuery_IVARS(loaded);
     Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
     loaded_ivars->field
-        = (CharBuf*)CERTIFY(Freezer_load(field), CHARBUF);
+        = (String*)CERTIFY(Freezer_load(field), STRING);
     Obj *terms = CERTIFY(Hash_Fetch_Str(source, "terms", 5), OBJ);
     loaded_ivars->terms
         = (VArray*)CERTIFY(Freezer_load(terms), VARRAY);
@@ -126,29 +126,29 @@ PhraseQuery_Equals_IMP(PhraseQuery *self, Obj *other) {
     if (ivars->boost != ovars->boost)  { return false; }
     if (ivars->field && !ovars->field) { return false; }
     if (!ivars->field && ovars->field) { return false; }
-    if (ivars->field && !CB_Equals(ivars->field, (Obj*)ovars->field)) {
+    if (ivars->field && !Str_Equals(ivars->field, (Obj*)ovars->field)) {
         return false;
     }
     if (!VA_Equals(ovars->terms, (Obj*)ivars->terms)) { return false; }
     return true;
 }
 
-CharBuf*
+String*
 PhraseQuery_To_String_IMP(PhraseQuery *self) {
     PhraseQueryIVARS *const ivars = PhraseQuery_IVARS(self);
     uint32_t  num_terms = VA_Get_Size(ivars->terms);
-    CharBuf  *retval    = CB_Clone(ivars->field);
-    CB_Cat_Trusted_Str(retval, ":\"", 2);
+    String   *retval    = Str_Clone(ivars->field);
+    Str_Cat_Trusted_Str(retval, ":\"", 2);
     for (uint32_t i = 0; i < num_terms; i++) {
         Obj     *term        = VA_Fetch(ivars->terms, i);
-        CharBuf *term_string = Obj_To_String(term);
-        CB_Cat(retval, term_string);
+        String *term_string = Obj_To_String(term);
+        Str_Cat(retval, term_string);
         DECREF(term_string);
         if (i < num_terms - 1) {
-            CB_Cat_Trusted_Str(retval, " ",  1);
+            Str_Cat_Trusted_Str(retval, " ",  1);
         }
     }
-    CB_Cat_Trusted_Str(retval, "\"", 1);
+    Str_Cat_Trusted_Str(retval, "\"", 1);
     return retval;
 }
 
@@ -178,7 +178,7 @@ PhraseQuery_Make_Compiler_IMP(PhraseQuery *self, Searcher *searcher,
     }
 }
 
-CharBuf*
+String*
 PhraseQuery_Get_Field_IMP(PhraseQuery *self) {
     return PhraseQuery_IVARS(self)->field;
 }
@@ -339,7 +339,7 @@ PhraseCompiler_Make_Matcher_IMP(PhraseCompiler *self, SegReader *reader,
 
 VArray*
 PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher,
-                                   DocVector *doc_vec, const CharBuf *field) {
+                                   DocVector *doc_vec, const String *field) {
     PhraseCompilerIVARS *const ivars = PhraseCompiler_IVARS(self);
     PhraseQueryIVARS *const parent_ivars
         = PhraseQuery_IVARS((PhraseQuery*)ivars->parent);
@@ -350,7 +350,7 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher,
 
     // Bail if no terms or field doesn't match.
     if (!num_terms) { return spans; }
-    if (!CB_Equals(field, (Obj*)parent_ivars->field)) { return spans; }
+    if (!Str_Equals(field, (Obj*)parent_ivars->field)) { return spans; }
 
     VArray *term_vectors    = VA_new(num_terms);
     BitVector *posit_vec       = BitVec_new(0);
@@ -358,7 +358,7 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher,
     for (uint32_t i = 0; i < num_terms; i++) {
         Obj *term = VA_Fetch(terms, i);
         TermVector *term_vector
-            = DocVec_Term_Vector(doc_vec, field, (CharBuf*)term);
+            = DocVec_Term_Vector(doc_vec, field, (String*)term);
 
         // Bail if any term is missing.
         if (!term_vector) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/PhraseQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.cfh b/core/Lucy/Search/PhraseQuery.cfh
index eaae333..c8609f2 100644
--- a/core/Lucy/Search/PhraseQuery.cfh
+++ b/core/Lucy/Search/PhraseQuery.cfh
@@ -24,22 +24,22 @@ parcel Lucy;
 
 public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query {
 
-    CharBuf       *field;
+    String        *field;
     VArray        *terms;
 
     inert incremented PhraseQuery*
-    new(const CharBuf *field, VArray *terms);
+    new(const String *field, VArray *terms);
 
     /**
      * @param field The field that the phrase must occur in.
      * @param terms The ordered array of terms that must match.
      */
     public inert PhraseQuery*
-    init(PhraseQuery *self, const CharBuf *field, VArray *terms);
+    init(PhraseQuery *self, const String *field, VArray *terms);
 
     /** Accessor for object's field attribute.
      */
-    public CharBuf*
+    public String*
     Get_Field(PhraseQuery *self);
 
     /** Accessor for object's array of terms.
@@ -54,7 +54,7 @@ public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query {
     public bool
     Equals(PhraseQuery *self, Obj *other);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(PhraseQuery *self);
 
     public void
@@ -102,7 +102,7 @@ class Lucy::Search::PhraseCompiler
 
     public incremented VArray*
     Highlight_Spans(PhraseCompiler *self, Searcher *searcher,
-                    DocVector *doc_vec, const CharBuf *field);
+                    DocVector *doc_vec, const String *field);
 
     public bool
     Equals(PhraseCompiler *self, Obj *other);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/PolyQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c
index 063888e..45f6129 100644
--- a/core/Lucy/Search/PolyQuery.c
+++ b/core/Lucy/Search/PolyQuery.c
@@ -185,7 +185,7 @@ PolyCompiler_Apply_Norm_Factor_IMP(PolyCompiler *self, float factor) {
 
 VArray*
 PolyCompiler_Highlight_Spans_IMP(PolyCompiler *self, Searcher *searcher,
-                                 DocVector *doc_vec, const CharBuf *field) {
+                                 DocVector *doc_vec, const String *field) {
     PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self);
     VArray *spans = VA_new(0);
     for (uint32_t i = 0, max = VA_Get_Size(ivars->children); i < max; i++) {
@@ -213,7 +213,7 @@ PolyCompiler_Serialize_IMP(PolyCompiler *self, OutStream *outstream) {
 PolyCompiler*
 PolyCompiler_Deserialize_IMP(PolyCompiler *self, InStream *instream) {
     PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self);
-    CharBuf *class_name = Freezer_read_charbuf(instream);
+    String *class_name = Freezer_read_charbuf(instream);
     DECREF(class_name); // TODO Don't serialize class name.
     ivars->children = Freezer_read_varray(instream);
     PolyCompiler_Deserialize_t super_deserialize

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/PolyQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.cfh b/core/Lucy/Search/PolyQuery.cfh
index f0c78ff..5208f92 100644
--- a/core/Lucy/Search/PolyQuery.cfh
+++ b/core/Lucy/Search/PolyQuery.cfh
@@ -88,7 +88,7 @@ class Lucy::Search::PolyCompiler inherits Lucy::Search::Compiler {
 
     public incremented VArray*
     Highlight_Spans(PolyCompiler *self, Searcher *searcher,
-                    DocVector *doc_vec, const CharBuf *field);
+                    DocVector *doc_vec, const String *field);
 
     public void
     Destroy(PolyCompiler *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/PolySearcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolySearcher.c b/core/Lucy/Search/PolySearcher.c
index caa8945..54f7565 100644
--- a/core/Lucy/Search/PolySearcher.c
+++ b/core/Lucy/Search/PolySearcher.c
@@ -105,7 +105,7 @@ PolySearcher_Doc_Max_IMP(PolySearcher *self) {
 }
 
 uint32_t
-PolySearcher_Doc_Freq_IMP(PolySearcher *self, const CharBuf *field, Obj *term) {
+PolySearcher_Doc_Freq_IMP(PolySearcher *self, const String *field, Obj *term) {
     PolySearcherIVARS *const ivars = PolySearcher_IVARS(self);
     uint32_t doc_freq = 0;
     for (uint32_t i = 0, max = VA_Get_Size(ivars->searchers); i < max; i++) {