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 2014/07/04 23:11:11 UTC
[06/10] git commit: refs/heads/master - Cease unique-ifying values in
SortFieldWriter.
Cease unique-ifying values in SortFieldWriter.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7ec27669
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7ec27669
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7ec27669
Branch: refs/heads/master
Commit: 7ec276695c8398f63f121e315716de7b43fdab13
Parents: 836d574
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 3 13:13:10 2014 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Fri Jul 4 14:10:07 2014 -0700
----------------------------------------------------------------------
core/Lucy/Index/SortFieldWriter.c | 53 ++++++++------------------------
core/Lucy/Index/SortFieldWriter.cfh | 4 ---
2 files changed, 12 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/7ec27669/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index a59ed3d..31b04e8 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -133,32 +133,13 @@ SortFieldWriter_init(SortFieldWriter *self, Schema *schema,
ivars->mem_per_entry += VTable_Get_Obj_Alloc_Size(FLOAT64);
ivars->var_width = false;
}
- ivars->uniq_vals = Hash_new(0);
return self;
}
void
-SortFieldWriter_Clear_Buffer_IMP(SortFieldWriter *self) {
- SortFieldWriterIVARS *const ivars = SortFieldWriter_IVARS(self);
- if (ivars->uniq_vals) {
- Hash_Clear(ivars->uniq_vals);
- }
- SortFieldWriter_Clear_Buffer_t super_clear_buffer
- = SUPER_METHOD_PTR(SORTFIELDWRITER, LUCY_SortFieldWriter_Clear_Buffer);
- super_clear_buffer(self);
- // Note that we have not Reset() the Counter which tracks memory usage.
- // This is because the counter is shared amongst multiple SortFieldWriters
- // which belong to a parent SortWriter; it is the responsibility of the
- // parent SortWriter to reset it once **all** of its child
- // SortFieldWriters have cleared their buffers.
-}
-
-void
SortFieldWriter_Destroy_IMP(SortFieldWriter *self) {
SortFieldWriterIVARS *const ivars = SortFieldWriter_IVARS(self);
- DECREF(ivars->uniq_vals);
- ivars->uniq_vals = NULL;
DECREF(ivars->field);
DECREF(ivars->schema);
DECREF(ivars->snapshot);
@@ -191,29 +172,19 @@ SortFieldWriter_Get_Ord_Width_IMP(SortFieldWriter *self) {
void
SortFieldWriter_Add_IMP(SortFieldWriter *self, int32_t doc_id, Obj *value) {
SortFieldWriterIVARS *const ivars = SortFieldWriter_IVARS(self);
- Hash *uniq_vals = ivars->uniq_vals;
Counter *counter = ivars->counter;
-
- // Uniq-ify the value.
- int32_t hash_sum = Obj_Hash_Sum(value);
- Obj *uniq_val = Hash_Find_Key(uniq_vals, value, hash_sum);
- if (!uniq_val) {
- Hash_Store(uniq_vals, value, (Obj*)CFISH_TRUE);
- Counter_Add(counter, ivars->mem_per_entry);
- if (ivars->prim_id == FType_TEXT) {
- int64_t size = Str_Get_Size((String*)value) + 1;
- size = SI_increase_to_word_multiple(size);
- Counter_Add(counter, size);
- }
- else if (ivars->prim_id == FType_BLOB) {
- int64_t size = BB_Get_Size((ByteBuf*)value) + 1;
- size = SI_increase_to_word_multiple(size);
- Counter_Add(counter, size);
- }
- uniq_val = Hash_Find_Key(uniq_vals, value, hash_sum);
+ Counter_Add(counter, ivars->mem_per_entry);
+ if (ivars->prim_id == FType_TEXT) {
+ int64_t size = Str_Get_Size((String*)value) + 1;
+ size = SI_increase_to_word_multiple(size);
+ Counter_Add(counter, size);
}
-
- SFWriterElem *elem = S_SFWriterElem_create(uniq_val, doc_id);
+ else if (ivars->prim_id == FType_BLOB) {
+ int64_t size = BB_Get_Size((ByteBuf*)value) + 1;
+ size = SI_increase_to_word_multiple(size);
+ Counter_Add(counter, size);
+ }
+ SFWriterElem *elem = S_SFWriterElem_create(Obj_Clone(value), doc_id);
SortFieldWriter_Feed(self, (Obj*)elem);
ivars->count++;
}
@@ -770,7 +741,7 @@ static SFWriterElem*
S_SFWriterElem_create(Obj *value, int32_t doc_id) {
SFWriterElem *self = (SFWriterElem*)VTable_Make_Obj(SFWRITERELEM);
SFWriterElemIVARS *ivars = SFWriterElem_IVARS(self);
- ivars->value = INCREF(value);
+ ivars->value = value;
ivars->doc_id = doc_id;
return self;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/7ec27669/core/Lucy/Index/SortFieldWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.cfh b/core/Lucy/Index/SortFieldWriter.cfh
index 22b2d74..a2d0ddc 100644
--- a/core/Lucy/Index/SortFieldWriter.cfh
+++ b/core/Lucy/Index/SortFieldWriter.cfh
@@ -19,7 +19,6 @@ parcel Lucy;
class Lucy::Index::SortFieldWriter
inherits Lucy::Util::SortExternal {
String *field;
- Hash *uniq_vals;
Schema *schema;
Snapshot *snapshot;
Segment *segment;
@@ -86,9 +85,6 @@ class Lucy::Index::SortFieldWriter
int
Compare(SortFieldWriter *self, void *va, void *vb);
- void
- Clear_Buffer(SortFieldWriter *self);
-
int32_t
Get_Null_Ord(SortFieldWriter *self);