Mailing List Archive

r3843 - in trunk: c_src/KinoSearch c_src/KinoSearch/Index c_src/KinoSearch/Test perl/lib perl/t perl/xs/KinoSearch
Author: creamyg
Date: 2008-09-08 13:00:39 -0700 (Mon, 08 Sep 2008)
New Revision: 3843

Modified:
trunk/c_src/KinoSearch/Index/IndexReader.c
trunk/c_src/KinoSearch/Index/LexWriter.c
trunk/c_src/KinoSearch/Index/PostingPool.bp
trunk/c_src/KinoSearch/Index/PostingPool.c
trunk/c_src/KinoSearch/Index/PostingsWriter.bp
trunk/c_src/KinoSearch/Index/PostingsWriter.c
trunk/c_src/KinoSearch/Index/SegInfo.bp
trunk/c_src/KinoSearch/Index/SegInfo.c
trunk/c_src/KinoSearch/Index/SegWriter.c
trunk/c_src/KinoSearch/Index/Snapshot.c
trunk/c_src/KinoSearch/Index/TermVectorsReader.c
trunk/c_src/KinoSearch/Index/TermVectorsWriter.c
trunk/c_src/KinoSearch/Schema.bp
trunk/c_src/KinoSearch/Schema.c
trunk/c_src/KinoSearch/Test/TestQueryParserLogic.c
trunk/perl/lib/KinoSearch.pm
trunk/perl/t/214-spec_field.t
trunk/perl/t/511-sort_spec.t
trunk/perl/xs/KinoSearch/Schema.c
Log:
Substitute "field" in place of "field_name" for some variable names.


Modified: trunk/c_src/KinoSearch/Index/IndexReader.c
===================================================================
--- trunk/c_src/KinoSearch/Index/IndexReader.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/IndexReader.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -213,9 +213,9 @@
}

I32Array*
-IxReader_fetch_sort_cache(IndexReader *self, const CharBuf *field_name)
+IxReader_fetch_sort_cache(IndexReader *self, const CharBuf *field)
{
- I32Array *sort_cache = (I32Array*)Hash_Fetch(self->sort_caches, field_name);
+ I32Array *sort_cache = (I32Array*)Hash_Fetch(self->sort_caches, field);

if (sort_cache == NULL) {
FieldSpec *fspec;
@@ -223,21 +223,21 @@

/* Enforce 1 value per field constraint. */
fspec = Schema_Fetch_FSpec(
- InvIndex_Get_Schema(self->invindex), field_name);
+ InvIndex_Get_Schema(self->invindex), field);
if (!fspec->indexed || fspec->analyzed) {
- CONFESS("%o' is not an indexed, un-analyzed field", field_name);
+ CONFESS("%o' is not an indexed, un-analyzed field", field);
}

/* Acquire the sort cache, if possible. */
- lexicon = IxReader_Lexicon(self, field_name, NULL);
+ lexicon = IxReader_Lexicon(self, field, NULL);
if (lexicon != NULL) {
i32_t max_docs = IxReader_Max_Docs(self);
PostingList *plist
- = IxReader_Posting_List(self, field_name, NULL);
+ = IxReader_Posting_List(self, field, NULL);
sort_cache = Lex_Build_Sort_Cache(lexicon, plist, max_docs);
if (OBJ_IS_A(lexicon, MULTILEXICON)) {
LexCache *lex_cache = ((MultiLexicon*)lexicon)->lex_cache;
- Hash_Store(self->lex_caches, field_name, (Obj*)lex_cache);
+ Hash_Store(self->lex_caches, field, (Obj*)lex_cache);
}
REFCOUNT_DEC(plist);
}
@@ -247,7 +247,7 @@
}

/* Cache the sort cache. */
- Hash_Store(self->sort_caches, field_name, (Obj*)sort_cache);
+ Hash_Store(self->sort_caches, field, (Obj*)sort_cache);
REFCOUNT_DEC(sort_cache);
REFCOUNT_DEC(lexicon);
}

Modified: trunk/c_src/KinoSearch/Index/LexWriter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/LexWriter.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/LexWriter.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -127,12 +127,12 @@
void
LexWriter_finish_field(LexWriter *self, i32_t field_num)
{
- CharBuf *field_name = SegInfo_Field_Name(self->seg_info, field_num);
+ CharBuf *field = SegInfo_Field_Name(self->seg_info, field_num);
CharBuf *count = CB_newf("%i32", self->count);
OutStream_Close(self->outstream);
REFCOUNT_DEC(self->outstream);
self->outstream = NULL;
- Hash_Store(self->counts, field_name, (Obj*)count);
+ Hash_Store(self->counts, field, (Obj*)count);
REFCOUNT_DEC(count);

/* Finish other. */

Modified: trunk/c_src/KinoSearch/Index/PostingPool.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingPool.bp 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/PostingPool.bp 2008-09-08 20:00:39 UTC (rev 3843)
@@ -4,7 +4,7 @@
extends KinoSearch::Util::SortExRun {

Schema *schema;
- CharBuf *field_name;
+ CharBuf *field;
FieldSpec *fspec;
Posting *posting;
LexStepper *lex_stepper;
@@ -29,10 +29,10 @@
/* Constructors.
*/
static incremented PostingPool*
- new(Schema *schema, const CharBuf *field_name, MemoryPool *mem_pool);
+ new(Schema *schema, const CharBuf *field, MemoryPool *mem_pool);

static PostingPool*
- init(PostingPool *self, Schema *schema, const CharBuf *field_name,
+ init(PostingPool *self, Schema *schema, const CharBuf *field,
MemoryPool *mem_pool);

/* Add an element to the cache. Multiple elements need not be added in

Modified: trunk/c_src/KinoSearch/Index/PostingPool.c
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingPool.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/PostingPool.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -18,15 +18,15 @@
/* Constructor.
*/
PostingPool*
-PostPool_new(Schema *schema, const CharBuf *field_name, MemoryPool *mem_pool)
+PostPool_new(Schema *schema, const CharBuf *field, MemoryPool *mem_pool)
{
PostingPool *self = (PostingPool*)CREATE(NULL, POSTINGPOOL);
- return PostPool_init(self, schema, field_name, mem_pool);
+ return PostPool_init(self, schema, field, mem_pool);
}

PostingPool*
PostPool_init(PostingPool *self, Schema *schema,
- const CharBuf *field_name, MemoryPool *mem_pool)
+ const CharBuf *field, MemoryPool *mem_pool)
{
/* Init. */
SortExRun_init((SortExRun*)self);
@@ -45,18 +45,18 @@
self->post_count = 0;
self->scratch = NULL;
self->scratch_cap = 0;
- self->lex_stepper = LexStepper_new(field_name,
+ self->lex_stepper = LexStepper_new(field,
schema->skip_interval, false);

/* Assign. */
self->schema = REFCOUNT_INC(schema);
self->mem_pool = REFCOUNT_INC(mem_pool);
- self->field_name = CB_Clone(field_name);
+ self->field = CB_Clone(field);

/* Derive. */
- self->posting = Schema_Fetch_Posting(schema, field_name);
+ self->posting = Schema_Fetch_Posting(schema, field);
self->posting = (Posting*)Post_Clone(self->posting);
- self->fspec = Schema_Fetch_FSpec(schema, field_name);
+ self->fspec = Schema_Fetch_FSpec(schema, field);
(void)REFCOUNT_INC(self->fspec);
self->compare = PostPoolQ_compare_rawp;

@@ -74,7 +74,7 @@
{
REFCOUNT_DEC(self->schema);
REFCOUNT_DEC(self->mem_pool);
- REFCOUNT_DEC(self->field_name);
+ REFCOUNT_DEC(self->field);
REFCOUNT_DEC(self->lex_instream);
REFCOUNT_DEC(self->post_instream);
REFCOUNT_DEC(self->lex_stepper);
@@ -117,7 +117,7 @@
SegInfo *other_seg_info, i32_t doc_base, I32Array *doc_map)
{
CharBuf *lex_filename;
- i32_t field_num = SegInfo_Field_Num(other_seg_info, self->field_name);
+ i32_t field_num = SegInfo_Field_Num(other_seg_info, self->field);

/* Dedicate pool to this task alone. */
if (self->from_seg || self->cache_max > 0 || self->lex_end != 0)

Modified: trunk/c_src/KinoSearch/Index/PostingsWriter.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingsWriter.bp 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/PostingsWriter.bp 2008-09-08 20:00:39 UTC (rev 3843)
@@ -37,7 +37,7 @@
*/
void
Add_Inversion(PostingsWriter *self, Inversion *inversion,
- const CharBuf *field_name, i32_t doc_num, float doc_boost,
+ const CharBuf *field, i32_t doc_num, float doc_boost,
float length_norm);

void

Modified: trunk/c_src/KinoSearch/Index/PostingsWriter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingsWriter.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/PostingsWriter.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -28,7 +28,7 @@
* pool, create a VArray to hold this and subsequent pools.
*/
static void
-init_posting_pool(PostingsWriter *self, const CharBuf *field_name);
+init_posting_pool(PostingsWriter *self, const CharBuf *field);

/* Flush at least 75% of the acculumulated RAM cache to disk.
*/
@@ -104,12 +104,12 @@
}

static void
-init_posting_pool(PostingsWriter *self, const CharBuf *field_name)
+init_posting_pool(PostingsWriter *self, const CharBuf *field)
{
Schema *schema = InvIndex_Get_Schema(self->invindex);
- i32_t field_num = SegInfo_Field_Num(self->seg_info, field_name);
+ i32_t field_num = SegInfo_Field_Num(self->seg_info, field);
VArray *field_post_pools = (VArray*)VA_Fetch(self->post_pools, field_num);
- PostingPool *post_pool = PostPool_new(schema, field_name, self->mem_pool);
+ PostingPool *post_pool = PostPool_new(schema, field, self->mem_pool);

if (field_post_pools == NULL) {
field_post_pools = VA_new(1);
@@ -133,11 +133,11 @@
while (Inverter_Next(inverter)) {
FieldSpec *fspec = Inverter_Get_FSpec(inverter);
if (fspec->indexed) {
- ViewCharBuf *field_name = Inverter_Get_Field_Name(inverter);
+ ViewCharBuf *field = Inverter_Get_Field_Name(inverter);
Similarity *sim = Inverter_Get_Similarity(inverter);
Inversion *inversion = Inverter_Get_Inversion(inverter);
float length_norm = Sim_Length_Norm(sim, inversion->size);
- PostWriter_add_inversion(self, inversion, (CharBuf*)field_name, doc_num,
+ PostWriter_add_inversion(self, inversion, (CharBuf*)field, doc_num,
doc_boost, length_norm);
}
}
@@ -145,17 +145,17 @@

void
PostWriter_add_inversion(PostingsWriter *self, Inversion *inversion,
- const CharBuf *field_name, i32_t doc_num,
+ const CharBuf *field, i32_t doc_num,
float doc_boost, float length_norm)
{
- i32_t field_num = SegInfo_Field_Num(self->seg_info, field_name);
+ i32_t field_num = SegInfo_Field_Num(self->seg_info, field);
PostingPool *post_pool;
VArray *field_post_pools;

/* Retrieve the current PostingPool for this field. */
field_post_pools = (VArray*)VA_Fetch(self->post_pools, field_num);
if (field_post_pools == NULL) {
- init_posting_pool(self, field_name);
+ init_posting_pool(self, field);
field_post_pools = (VArray*)VA_Fetch(self->post_pools, field_num);
}
post_pool = (PostingPool*)VA_Fetch(field_post_pools, 0);
@@ -205,7 +205,7 @@
LexWriter_Leave_Temp_Mode(self->lex_writer);

/* Store away this pool and start another. */
- init_posting_pool(self, post_pool->field_name);
+ init_posting_pool(self, post_pool->field);
}
}
}
@@ -404,9 +404,9 @@
VArray *all_fields = Schema_All_Fields(schema);

for (i = 0; i < all_fields->size; i++) {
- CharBuf *field_name = (CharBuf*)VA_Fetch(all_fields, i);
- i32_t old_field_num = SegInfo_Field_Num(other_seg_info, field_name);
- i32_t new_field_num = SegInfo_Field_Num(seg_info, field_name);
+ CharBuf *field = (CharBuf*)VA_Fetch(all_fields, i);
+ i32_t old_field_num = SegInfo_Field_Num(other_seg_info, field);
+ i32_t new_field_num = SegInfo_Field_Num(seg_info, field);
VArray *field_post_pools = NULL;
PostingPool *post_pool = NULL;

@@ -414,18 +414,18 @@
if (!old_field_num)
continue; /* not in old segment */
if (!new_field_num)
- CONFESS("Unrecognized field: %o", field_name);
+ CONFESS("Unrecognized field: %o", field);

/* Init field if we've never seen it before. */
field_post_pools = (VArray*)VA_Fetch(post_pools, new_field_num);
if (field_post_pools == NULL) {
- init_posting_pool(self, field_name);
+ init_posting_pool(self, field);
field_post_pools
= (VArray*)VA_Fetch(self->post_pools, new_field_num);
}

/* Create a pool and add it to the field's collection of pools. */
- post_pool = PostPool_new(schema, field_name, self->mem_pool);
+ post_pool = PostPool_new(schema, field, self->mem_pool);
PostPool_Assign_Seg(post_pool, other_folder, other_seg_info,
seg_info->doc_count, doc_map);
VA_Push(field_post_pools, (Obj*)post_pool);

Modified: trunk/c_src/KinoSearch/Index/SegInfo.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/SegInfo.bp 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/SegInfo.bp 2008-09-08 20:00:39 UTC (rev 3843)
@@ -35,7 +35,7 @@
* known, nothing will happen.
*/
void
- Add_Field(SegInfo *self, const CharBuf *field_name);
+ Add_Field(SegInfo *self, const CharBuf *field);

/** Store arbitrary data in the segment's metadata, to be serialized
* later. Callers should be very conservative about what they place here,
@@ -68,7 +68,7 @@
* found.
*/
i32_t
- Field_Num(SegInfo *self, const CharBuf *field_name);
+ Field_Num(SegInfo *self, const CharBuf *field);

/** Getter for the object's seg name.
*/

Modified: trunk/c_src/KinoSearch/Index/SegInfo.c
===================================================================
--- trunk/c_src/KinoSearch/Index/SegInfo.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/SegInfo.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -52,7 +52,7 @@
}
}
else if (fspecs != NULL) {
- CharBuf *field_name;
+ CharBuf *field;
Obj *ignore;

/* Init. */
@@ -64,8 +64,8 @@

/* Add all fields in the fspecs. */
Hash_Iter_Init(fspecs);
- while (Hash_Iter_Next(fspecs, &field_name, &ignore)) {
- SegInfo_Add_Field(self, field_name);
+ while (Hash_Iter_Next(fspecs, &field, &ignore)) {
+ SegInfo_Add_Field(self, field);
}
}
else {
@@ -76,11 +76,11 @@
}

void
-SegInfo_add_field(SegInfo *self, const CharBuf *field_name)
+SegInfo_add_field(SegInfo *self, const CharBuf *field)
{
- if ( (Hash_Fetch(self->by_name, field_name)) == NULL) {
+ if ( (Hash_Fetch(self->by_name, field)) == NULL) {
Num *num = Num_new(self->by_num->size);
- CharBuf *name_copy = CB_Clone(field_name);
+ CharBuf *name_copy = CB_Clone(field);
VA_Push(self->by_num, (Obj*)name_copy);
Hash_Store(self->by_name, name_copy, (Obj*)num);
REFCOUNT_DEC(name_copy);
@@ -150,13 +150,13 @@
}

i32_t
-SegInfo_field_num(SegInfo *self, const CharBuf *field_name)
+SegInfo_field_num(SegInfo *self, const CharBuf *field)
{
- if (field_name == NULL) {
+ if (field == NULL) {
return 0;
}
else {
- Num *num = (Num*)Hash_Fetch(self->by_name, field_name);
+ Num *num = (Num*)Hash_Fetch(self->by_name, field);
if (num == NULL)
return 0;
return (i32_t)num->value;

Modified: trunk/c_src/KinoSearch/Index/SegWriter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/SegWriter.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/SegWriter.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -56,9 +56,9 @@
/* Add previously unseen fields to the segment. */
Inverter_Iter_Init(inverter);
while (Inverter_Next(inverter)) {
- ViewCharBuf *field_name = Inverter_Get_Field_Name(inverter);
- if ( !SegInfo_Field_Num(seg_info, (CharBuf*)field_name) ) {
- SegInfo_Add_Field(seg_info, (CharBuf*)field_name);
+ ViewCharBuf *field = Inverter_Get_Field_Name(inverter);
+ if ( !SegInfo_Field_Num(seg_info, (CharBuf*)field) ) {
+ SegInfo_Add_Field(seg_info, (CharBuf*)field);
}
}


Modified: trunk/c_src/KinoSearch/Index/Snapshot.c
===================================================================
--- trunk/c_src/KinoSearch/Index/Snapshot.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/Snapshot.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -188,12 +188,12 @@
self->generation++;
filename = Snapshot_Filename(self);

- /* Build a hash of field_name => fspec_class pairings. */
+ /* Build a hash of field => fspec_class pairings. */
for (i = 0; i < all_fields->size; i++) {
- CharBuf *field_name = (CharBuf*)VA_Fetch(all_fields, i);
- FieldSpec *fspec = (FieldSpec*)Schema_Fetch_FSpec(schema, field_name);
+ CharBuf *field = (CharBuf*)VA_Fetch(all_fields, i);
+ FieldSpec *fspec = (FieldSpec*)Schema_Fetch_FSpec(schema, field);
CharBuf *class_name = CB_Clone(Obj_Get_Class_Name(fspec));
- Hash_Store(fields, field_name, (Obj*)class_name);
+ Hash_Store(fields, field, (Obj*)class_name);
REFCOUNT_DEC(class_name);
}
REFCOUNT_DEC(all_fields);

Modified: trunk/c_src/KinoSearch/Index/TermVectorsReader.c
===================================================================
--- trunk/c_src/KinoSearch/Index/TermVectorsReader.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/TermVectorsReader.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -69,10 +69,10 @@

num_fields = InStream_Read_C32(self->tv_in);
while (num_fields--) {
- CharBuf *field_name = CB_deserialize(NULL, self->tv_in);
+ CharBuf *field = CB_deserialize(NULL, self->tv_in);
ByteBuf *field_buf = BB_deserialize(NULL, self->tv_in);
- DocVec_Add_Field_Buf(doc_vec, field_name, field_buf);
- REFCOUNT_DEC(field_name);
+ DocVec_Add_Field_Buf(doc_vec, field, field_buf);
+ REFCOUNT_DEC(field);
REFCOUNT_DEC(field_buf);
}


Modified: trunk/c_src/KinoSearch/Index/TermVectorsWriter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/TermVectorsWriter.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Index/TermVectorsWriter.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -72,10 +72,10 @@
while (Inverter_Next(inverter)) {
FieldSpec *fspec = Inverter_Get_FSpec(inverter);
if (fspec->vectorized) {
- ViewCharBuf *field_name = Inverter_Get_Field_Name(inverter);
+ ViewCharBuf *field = Inverter_Get_Field_Name(inverter);
Inversion *inversion = Inverter_Get_Inversion(inverter);
ByteBuf *tv_buf = TVWriter_TV_Buf(self, inversion);
- CB_Serialize(field_name, tv_out);
+ CB_Serialize(field, tv_out);
BB_Serialize(tv_buf, tv_out);
REFCOUNT_DEC(tv_buf);
}

Modified: trunk/c_src/KinoSearch/Schema.bp
===================================================================
--- trunk/c_src/KinoSearch/Schema.bp 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Schema.bp 2008-09-08 20:00:39 UTC (rev 3843)
@@ -47,25 +47,25 @@
* found, return NULL.
*/
FieldSpec*
- Fetch_FSpec(Schema *self, const CharBuf *field_name);
+ Fetch_FSpec(Schema *self, const CharBuf *field);

/** Return the Analyzer for the specified field. If a field-specific
* Analyzer can't be found, return the Schema's main Analyzer.
*/
Analyzer*
- Fetch_Analyzer(Schema *self, const CharBuf *field_name = NULL);
+ Fetch_Analyzer(Schema *self, const CharBuf *field = NULL);

/** Return the Similarity for the specified field. If a field-specific
* Similarity can't be found, return the Schema's main Similarity.
*/
Similarity*
- Fetch_Sim(Schema *self, const CharBuf *field_name = NULL);
+ Fetch_Sim(Schema *self, const CharBuf *field = NULL);

/** Return a Posting object created by the field's FieldSpec. Client code
* should clone the object rather than use it directly.
*/
Posting*
- Fetch_Posting(Schema *self, const CharBuf *field_name);
+ Fetch_Posting(Schema *self, const CharBuf *field);

/** Return the number of fields currently defined.
*/
@@ -77,7 +77,7 @@
* Return 0 if the field name can't be found.
*/
i32_t
- Field_Num(Schema *self, const CharBuf *field_name);
+ Field_Num(Schema *self, const CharBuf *field);

/** Return all the Schema's field names.
*/

Modified: trunk/c_src/KinoSearch/Schema.c
===================================================================
--- trunk/c_src/KinoSearch/Schema.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Schema.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -11,7 +11,7 @@
#include "KinoSearch/Search/Similarity.h"

static void
-add_fspec(Schema *self, const CharBuf *field_name, FieldSpec *fspec);
+add_fspec(Schema *self, const CharBuf *field, FieldSpec *fspec);

static Hash* fspec_singletons = NULL;

@@ -126,11 +126,11 @@
}

static void
-add_fspec(Schema *self, const CharBuf *field_name, FieldSpec *fspec)
+add_fspec(Schema *self, const CharBuf *field, FieldSpec *fspec)
{
- if ( (Hash_Fetch(self->fspecs, field_name)) == NULL) {
+ if ( (Hash_Fetch(self->fspecs, field)) == NULL) {
Num *num = Num_new(self->by_num->size);
- CharBuf *name_copy = CB_Clone(field_name);
+ CharBuf *name_copy = CB_Clone(field);
CharBuf *fspec_class = Obj_Get_Class_Name(fspec);
Hash *fspec_helpers = (Hash*)Hash_Fetch(self->helpers, fspec_class);
Analyzer *analyzer = NULL;
@@ -197,44 +197,43 @@
}

FieldSpec*
-Schema_fetch_fspec(Schema *self, const CharBuf *field_name)
+Schema_fetch_fspec(Schema *self, const CharBuf *field)
{
- return (FieldSpec*)Hash_Fetch(self->fspecs, field_name);
+ return (FieldSpec*)Hash_Fetch(self->fspecs, field);
}

Analyzer*
-Schema_fetch_analyzer(Schema *self, const CharBuf *field_name)
+Schema_fetch_analyzer(Schema *self, const CharBuf *field)
{
- if (field_name == NULL) {
+ if (field == NULL) {
return self->analyzer;
}
else {
- Analyzer *analyzer
- = (Analyzer*)Hash_Fetch(self->analyzers, field_name);
+ Analyzer *analyzer = (Analyzer*)Hash_Fetch(self->analyzers, field);
return analyzer ? analyzer : self->analyzer;
}
}

Similarity*
-Schema_fetch_sim(Schema *self, const CharBuf *field_name)
+Schema_fetch_sim(Schema *self, const CharBuf *field)
{
- if (field_name == NULL) {
+ if (field == NULL) {
return self->sim;
}
else {
- Similarity *sim = (Similarity*)Hash_Fetch(self->sims, field_name);
+ Similarity *sim = (Similarity*)Hash_Fetch(self->sims, field);
return sim ? sim : self->sim;
}
}

Posting*
-Schema_fetch_posting(Schema *self, const CharBuf *field_name)
+Schema_fetch_posting(Schema *self, const CharBuf *field)
{
- if (field_name == NULL) {
+ if (field == NULL) {
return NULL;
}
else {
- Posting *posting = (Posting*)Hash_Fetch(self->postings, field_name);
+ Posting *posting = (Posting*)Hash_Fetch(self->postings, field);
return posting ? posting : NULL;
}
}
@@ -251,13 +250,13 @@
Schema_get_skip_interval(Schema *self) { return self->skip_interval; }

i32_t
-Schema_field_num(Schema *self, const CharBuf *field_name)
+Schema_field_num(Schema *self, const CharBuf *field)
{
- if (field_name == NULL) {
+ if (field == NULL) {
return 0;
}
else {
- Num *num = (Num*)Hash_Fetch(self->by_name, field_name);
+ Num *num = (Num*)Hash_Fetch(self->by_name, field);
if (num == NULL)
return 0;
return (i32_t)num->value;

Modified: trunk/c_src/KinoSearch/Test/TestQueryParserLogic.c
===================================================================
--- trunk/c_src/KinoSearch/Test/TestQueryParserLogic.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/c_src/KinoSearch/Test/TestQueryParserLogic.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -643,9 +643,9 @@
u32_t i, max;

for (i = 0, max = doc_set->size; i < max; i++) {
- static CharBuf field_name = ZCB_LITERAL("content");
+ static CharBuf field = ZCB_LITERAL("content");
Doc *doc = Doc_new(NULL, 0, 1.0f);
- Doc_Store(doc, &field_name, VA_Fetch(doc_set, i));
+ Doc_Store(doc, &field, VA_Fetch(doc_set, i));
InvIndexer_Add_Doc(invindexer, doc);
REFCOUNT_DEC(doc);
}

Modified: trunk/perl/lib/KinoSearch.pm
===================================================================
--- trunk/perl/lib/KinoSearch.pm 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/perl/lib/KinoSearch.pm 2008-09-08 20:00:39 UTC (rev 3843)
@@ -250,11 +250,11 @@
$zlib_loaded = 1;
}
my $schema = $self->get_invindex->get_schema;
- for my $field_name ( keys %$doc ) {
- my $fspec = $schema->fetch_fspec($field_name);
+ for my $field ( keys %$doc ) {
+ my $fspec = $schema->fetch_fspec($field);
next unless $fspec->compressed;
- $doc->{$field_name} = uncompress( $doc->{$field_name} );
- utf8_flag_on( $doc->{$field_name} ) unless $fspec->binary;
+ $doc->{$field} = uncompress( $doc->{$field} );
+ utf8_flag_on( $doc->{$field} ) unless $fspec->binary;
}
}
}

Modified: trunk/perl/t/214-spec_field.t
===================================================================
--- trunk/perl/t/214-spec_field.t 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/perl/t/214-spec_field.t 2008-09-08 20:00:39 UTC (rev 3843)
@@ -67,10 +67,10 @@
$invindexer->finish;

sub check {
- my ( $field_name, $query_text, $expected_num_hits ) = @_;
+ my ( $field, $query_text, $expected_num_hits ) = @_;

my $query = KinoSearch::Search::TermQuery->new(
- field => $field_name,
+ field => $field,
term => $query_text,
);

@@ -78,17 +78,13 @@

my $hits = $searcher->search( query => $query );

- is( $hits->total_hits, $expected_num_hits,
- "$field_name correct num hits " );
+ is( $hits->total_hits, $expected_num_hits, "$field correct num hits " );

# Don't check the contents of the hit if there aren't any.
return unless $expected_num_hits;

my $hit = $hits->next;
- is( $hit->{$field_name},
- 'United States',
- "$field_name correct doc returned"
- );
+ is( $hit->{$field}, 'United States', "$field correct doc returned" );
}

check( 'analyzed', 'States', 1 );

Modified: trunk/perl/t/511-sort_spec.t
===================================================================
--- trunk/perl/t/511-sort_spec.t 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/perl/t/511-sort_spec.t 2008-09-08 20:00:39 UTC (rev 3843)
@@ -154,10 +154,10 @@

my $sort_spec = KinoSearch::Search::SortSpec->new;
while (@criteria) {
- my $field_name = shift @criteria;
- my $rev = shift @criteria;
+ my $field = shift @criteria;
+ my $rev = shift @criteria;
$sort_spec->add(
- field => $field_name,
+ field => $field,
reverse => $rev,
);
}

Modified: trunk/perl/xs/KinoSearch/Schema.c
===================================================================
--- trunk/perl/xs/KinoSearch/Schema.c 2008-09-08 19:25:25 UTC (rev 3842)
+++ trunk/perl/xs/KinoSearch/Schema.c 2008-09-08 20:00:39 UTC (rev 3843)
@@ -15,7 +15,7 @@
}
else {
chy_u32_t num_keys = hv_iterinit(fields_hash);
- kino_ZombieCharBuf field_name = KINO_ZCB_BLANK;
+ kino_ZombieCharBuf field = KINO_ZCB_BLANK;
kino_ZombieCharBuf fspec_class = KINO_ZCB_BLANK;

while (num_keys--) {
@@ -36,9 +36,9 @@
key = SvPVutf8(key_sv, key_len);
}

- Kino_ZCB_Assign_Str(&field_name, key, key_len);
+ Kino_ZCB_Assign_Str(&field, key, key_len);
Kino_ZCB_Assign_Str(&fspec_class, value, value_len);
- Kino_Schema_Add_Field(self, (kino_CharBuf*)&field_name,
+ Kino_Schema_Add_Field(self, (kino_CharBuf*)&field,
(kino_CharBuf*)&fspec_class);
}
}


_______________________________________________
kinosearch-commits mailing list
kinosearch-commits@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch-commits