Mailing List Archive

r3762 - in trunk: c_src/KSx/Search c_src/KinoSearch c_src/KinoSearch/Doc c_src/KinoSearch/Index c_src/KinoSearch/Posting c_src/KinoSearch/Search c_src/KinoSearch/Search/HitCollector perl/xs/KinoSearch perl/xs/KinoSearch/Index
Author: creamyg
Date: 2008-08-25 13:16:50 -0700 (Mon, 25 Aug 2008)
New Revision: 3762

Modified:
trunk/c_src/KSx/Search/FilterScorer.bp
trunk/c_src/KSx/Search/FilterScorer.c
trunk/c_src/KinoSearch/Doc.bp
trunk/c_src/KinoSearch/Doc.c
trunk/c_src/KinoSearch/Doc/HitDoc.bp
trunk/c_src/KinoSearch/Doc/HitDoc.c
trunk/c_src/KinoSearch/Index/DocReader.bp
trunk/c_src/KinoSearch/Index/DocReader.c
trunk/c_src/KinoSearch/Index/DocWriter.bp
trunk/c_src/KinoSearch/Index/DocWriter.c
trunk/c_src/KinoSearch/Index/IndexReader.bp
trunk/c_src/KinoSearch/Index/IndexReader.c
trunk/c_src/KinoSearch/Index/Lexicon.bp
trunk/c_src/KinoSearch/Index/MultiLexicon.bp
trunk/c_src/KinoSearch/Index/MultiLexicon.c
trunk/c_src/KinoSearch/Index/MultiPostingList.bp
trunk/c_src/KinoSearch/Index/MultiPostingList.c
trunk/c_src/KinoSearch/Index/MultiReader.bp
trunk/c_src/KinoSearch/Index/MultiReader.c
trunk/c_src/KinoSearch/Index/PostingList.bp
trunk/c_src/KinoSearch/Index/PostingList.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/SegDataWriter.bp
trunk/c_src/KinoSearch/Index/SegInfo.bp
trunk/c_src/KinoSearch/Index/SegInfo.c
trunk/c_src/KinoSearch/Index/SegLexicon.bp
trunk/c_src/KinoSearch/Index/SegLexicon.c
trunk/c_src/KinoSearch/Index/SegPostingList.bp
trunk/c_src/KinoSearch/Index/SegPostingList.c
trunk/c_src/KinoSearch/Index/SegReader.bp
trunk/c_src/KinoSearch/Index/SegReader.c
trunk/c_src/KinoSearch/Index/SegWriter.bp
trunk/c_src/KinoSearch/Index/SegWriter.c
trunk/c_src/KinoSearch/Index/SkipStepper.bp
trunk/c_src/KinoSearch/Index/SkipStepper.c
trunk/c_src/KinoSearch/Index/TermVectorsWriter.bp
trunk/c_src/KinoSearch/Index/TermVectorsWriter.c
trunk/c_src/KinoSearch/Posting.bp
trunk/c_src/KinoSearch/Posting/MatchPosting.bp
trunk/c_src/KinoSearch/Posting/MatchPosting.c
trunk/c_src/KinoSearch/Posting/RawPosting.bp
trunk/c_src/KinoSearch/Posting/RawPosting.c
trunk/c_src/KinoSearch/Posting/RichPosting.bp
trunk/c_src/KinoSearch/Posting/RichPosting.c
trunk/c_src/KinoSearch/Posting/ScorePosting.bp
trunk/c_src/KinoSearch/Posting/ScorePosting.c
trunk/c_src/KinoSearch/Search/ANDScorer.bp
trunk/c_src/KinoSearch/Search/ANDScorer.c
trunk/c_src/KinoSearch/Search/FieldDoc.bp
trunk/c_src/KinoSearch/Search/FieldDoc.c
trunk/c_src/KinoSearch/Search/HitCollector.bp
trunk/c_src/KinoSearch/Search/HitCollector.c
trunk/c_src/KinoSearch/Search/HitCollector/SortCollector.bp
trunk/c_src/KinoSearch/Search/HitCollector/SortCollector.c
trunk/c_src/KinoSearch/Search/HitCollector/TopDocCollector.bp
trunk/c_src/KinoSearch/Search/HitCollector/TopDocCollector.c
trunk/c_src/KinoSearch/Search/MatchAllScorer.bp
trunk/c_src/KinoSearch/Search/MatchAllScorer.c
trunk/c_src/KinoSearch/Search/MultiSearcher.bp
trunk/c_src/KinoSearch/Search/MultiSearcher.c
trunk/c_src/KinoSearch/Search/NOTScorer.bp
trunk/c_src/KinoSearch/Search/NOTScorer.c
trunk/c_src/KinoSearch/Search/NoMatchScorer.bp
trunk/c_src/KinoSearch/Search/NoMatchScorer.c
trunk/c_src/KinoSearch/Search/ORScorer.bp
trunk/c_src/KinoSearch/Search/ORScorer.c
trunk/c_src/KinoSearch/Search/PhraseScorer.bp
trunk/c_src/KinoSearch/Search/PhraseScorer.c
trunk/c_src/KinoSearch/Search/RangeScorer.bp
trunk/c_src/KinoSearch/Search/RangeScorer.c
trunk/c_src/KinoSearch/Search/RemoteFieldDoc.bp
trunk/c_src/KinoSearch/Search/RemoteFieldDoc.c
trunk/c_src/KinoSearch/Search/RequiredOptionalScorer.bp
trunk/c_src/KinoSearch/Search/RequiredOptionalScorer.c
trunk/c_src/KinoSearch/Search/ScoreDoc.bp
trunk/c_src/KinoSearch/Search/ScoreDoc.c
trunk/c_src/KinoSearch/Search/Scorer.bp
trunk/c_src/KinoSearch/Search/Scorer.c
trunk/c_src/KinoSearch/Search/ScorerDocQueue.bp
trunk/c_src/KinoSearch/Search/ScorerDocQueue.c
trunk/c_src/KinoSearch/Search/Searchable.bp
trunk/c_src/KinoSearch/Search/TermScorer.bp
trunk/c_src/KinoSearch/Search/TermScorer.c
trunk/c_src/KinoSearch/Searcher.bp
trunk/c_src/KinoSearch/Searcher.c
trunk/perl/xs/KinoSearch/Doc.c
trunk/perl/xs/KinoSearch/Index/DocReader.c
Log:
Change KS to use i32_t for document numbers instead of u32_t, because A) The
range is limited by some i32_t bottlenecks anyway, and B) some algos may find
it handy to use negative document numbers as sentinels.


Modified: trunk/c_src/KSx/Search/FilterScorer.bp
===================================================================
--- trunk/c_src/KSx/Search/FilterScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KSx/Search/FilterScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -3,8 +3,8 @@
class KSx::Search::FilterScorer extends KinoSearch::Search::Scorer {

BitVector *bits;
- u32_t max_docs;
- u32_t doc_num;
+ i32_t max_docs;
+ i32_t doc_num;
Tally *tally;

/**
@@ -13,24 +13,24 @@
* @param max_docs The largest doc number that could possibly match.
*/
static incremented FilterScorer*
- new(BitVector *bits, u32_t max_docs);
+ new(BitVector *bits, i32_t max_docs);

static FilterScorer*
- init(FilterScorer *self, BitVector *bits, u32_t max_docs);
+ init(FilterScorer *self, BitVector *bits, i32_t max_docs);

void
Destroy(FilterScorer *self);

- public u32_t
+ public i32_t
Next(FilterScorer* self);

- public u32_t
- Skip_To(FilterScorer* self, u32_t target);
+ public i32_t
+ Skip_To(FilterScorer* self, i32_t target);

public Tally*
Tally(FilterScorer* self);

- public u32_t
+ public i32_t
Get_Doc_Num(FilterScorer* self);
}


Modified: trunk/c_src/KSx/Search/FilterScorer.c
===================================================================
--- trunk/c_src/KSx/Search/FilterScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KSx/Search/FilterScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -5,14 +5,14 @@
#include "KinoSearch/Util/BitVector.h"

FilterScorer*
-FilterScorer_new(BitVector *bits, u32_t max_docs)
+FilterScorer_new(BitVector *bits, i32_t max_docs)
{
FilterScorer *self = (FilterScorer*)CREATE(NULL, FILTERSCORER);
return FilterScorer_init(self, bits, max_docs);
}

FilterScorer*
-FilterScorer_init(FilterScorer *self, BitVector *bits, u32_t max_docs)
+FilterScorer_init(FilterScorer *self, BitVector *bits, i32_t max_docs)
{
Scorer_init((Scorer*)self, NULL);

@@ -35,7 +35,7 @@
Scorer_destroy((Scorer*)self);
}

-u32_t
+i32_t
FilterScorer_next(FilterScorer* self)
{
do {
@@ -47,8 +47,8 @@
return self->doc_num;
}

-u32_t
-FilterScorer_skip_to(FilterScorer* self, u32_t target)
+i32_t
+FilterScorer_skip_to(FilterScorer* self, i32_t target)
{
self->doc_num = target - 1;
return FilterScorer_next(self);
@@ -60,7 +60,7 @@
return self->tally;
}

-u32_t
+i32_t
FilterScorer_get_doc_num(FilterScorer* self)
{
return self->doc_num;

Modified: trunk/c_src/KinoSearch/Doc/HitDoc.bp
===================================================================
--- trunk/c_src/KinoSearch/Doc/HitDoc.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Doc/HitDoc.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -14,7 +14,7 @@
float score;

static incremented HitDoc*
- new(void *fields = NULL, u32_t doc_num = 0, float score = 0.0);
+ new(void *fields = NULL, i32_t doc_num = 0, float score = 0.0);

/** Constructor.
*
@@ -23,7 +23,7 @@
* @param score Number indicating how well the doc scored against a query.
*/
static HitDoc*
- init(HitDoc *self, void *fields = NULL, u32_t doc_num = 0,
+ init(HitDoc *self, void *fields = NULL, i32_t doc_num = 0,
float score = 0.0);

/** Throw an error (boost is invalid).

Modified: trunk/c_src/KinoSearch/Doc/HitDoc.c
===================================================================
--- trunk/c_src/KinoSearch/Doc/HitDoc.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Doc/HitDoc.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -5,14 +5,14 @@
#include "KinoSearch/Store/OutStream.h"

HitDoc*
-HitDoc_new(void *fields, u32_t doc_num, float score)
+HitDoc_new(void *fields, i32_t doc_num, float score)
{
HitDoc *self = (HitDoc*)CREATE(NULL, HITDOC);
return HitDoc_init(self, fields, doc_num, score);
}

HitDoc*
-HitDoc_init(HitDoc *self, void *fields, u32_t doc_num, float score)
+HitDoc_init(HitDoc *self, void *fields, i32_t doc_num, float score)
{
Doc_init((Doc*)self, fields, doc_num, 0.0f);
self->score = score;

Modified: trunk/c_src/KinoSearch/Doc.bp
===================================================================
--- trunk/c_src/KinoSearch/Doc.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Doc.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -9,11 +9,11 @@
public class KinoSearch::Doc extends KinoSearch::Obj {

void *fields;
- u32_t doc_num;
+ i32_t doc_num;
float boost;

static incremented Doc*
- new(void *fields = NULL, u32_t doc_num = 0, float boost = 1.0 );
+ new(void *fields = NULL, i32_t doc_num = 0, float boost = 1.0 );

/* Unimplemented constructor. */
/**
@@ -22,7 +22,7 @@
* @param doc_num Internal KinoSearch document number. Default of 0.
*/
public static Doc*
- init(Doc *self, void *fields = NULL, u32_t doc_num = 0, float boost = 1.0 );
+ init(Doc *self, void *fields = NULL, i32_t doc_num = 0, float boost = 1.0 );

/** Set boost attribute.
* Setting boost to something other than 1.0 causes a document to score
@@ -39,9 +39,9 @@
Get_Boost(Doc *self);

void
- Set_Doc_Num(Doc *self, u32_t doc_num);
+ Set_Doc_Num(Doc *self, i32_t doc_num);

- u32_t
+ i32_t
Get_Doc_Num(Doc *self);

/** Set the doc's field's attribute.

Modified: trunk/c_src/KinoSearch/Doc.c
===================================================================
--- trunk/c_src/KinoSearch/Doc.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Doc.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -3,7 +3,7 @@
#include "KinoSearch/Doc.h"

Doc*
-Doc_new(void *fields, u32_t doc_num, float boost)
+Doc_new(void *fields, i32_t doc_num, float boost)
{
Doc *self = (Doc*)CREATE(NULL, DOC);
return Doc_init(self, fields, doc_num, boost);
@@ -11,8 +11,8 @@

void Doc_set_boost(Doc *self, float boost) { self->boost = boost; }
float Doc_get_boost(Doc *self) { return self->boost; }
-void Doc_set_doc_num(Doc *self, u32_t doc_num) { self->doc_num = doc_num; }
-u32_t Doc_get_doc_num(Doc *self) { return self->doc_num; }
+void Doc_set_doc_num(Doc *self, i32_t doc_num) { self->doc_num = doc_num; }
+i32_t Doc_get_doc_num(Doc *self) { return self->doc_num; }
void* Doc_get_fields(Doc *self) { return self->fields; }

/* Copyright 2006-2008 Marvin Humphrey

Modified: trunk/c_src/KinoSearch/Index/DocReader.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/DocReader.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/DocReader.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -22,12 +22,12 @@
init(DocReader *self, InvIndex *invindex, SegInfo *seg_info);

incremented HitDoc*
- Fetch_Doc(DocReader *self, u32_t doc_num);
+ Fetch_Doc(DocReader *self, i32_t doc_num);

/** Read the content for the specified doc into the supplied buffer.
*/
void
- Read_Record(DocReader *self, ByteBuf *buffer, u32_t doc_num);
+ Read_Record(DocReader *self, ByteBuf *buffer, i32_t doc_num);

void
Close(DocReader *self);

Modified: trunk/c_src/KinoSearch/Index/DocReader.c
===================================================================
--- trunk/c_src/KinoSearch/Index/DocReader.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/DocReader.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -43,7 +43,7 @@
}

void
-DocReader_read_record(DocReader *self, ByteBuf *buffer, u32_t doc_num)
+DocReader_read_record(DocReader *self, ByteBuf *buffer, i32_t doc_num)
{
i64_t start, len;


Modified: trunk/c_src/KinoSearch/Index/DocWriter.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/DocWriter.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/DocWriter.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -21,7 +21,7 @@
init(DocWriter *self, InvIndex *invindex, SegInfo *seg_info);

void
- Add(DocWriter *self, Inverter *inverter, u32_t doc_num);
+ Add(DocWriter *self, Inverter *inverter, i32_t doc_num);

void
Add_Segment(DocWriter *self, SegReader *reader, I32Array *doc_map = NULL);

Modified: trunk/c_src/KinoSearch/Index/DocWriter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/DocWriter.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/DocWriter.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -47,18 +47,18 @@
}

void
-DocWriter_add(DocWriter *self, Inverter *inverter, u32_t doc_num)
+DocWriter_add(DocWriter *self, Inverter *inverter, i32_t doc_num)
{
OutStream *ds_out = self->ds_out;
OutStream *dsx_out = self->dsx_out;
u32_t num_stored = 0;
u64_t start = OutStream_Tell(ds_out);
bool_t have_compressed = false;
- u32_t expected = OutStream_Tell(dsx_out) / 16;
+ i64_t expected = OutStream_Tell(dsx_out) / 16;

/* Verify doc num. */
if (doc_num != expected)
- CONFESS("Expected doc num %u32 but got %u32", expected, doc_num);
+ CONFESS("Expected doc num %i64 but got %i32", expected, doc_num);

/* Write the number of stored fields. */
Inverter_Iter_Init(inverter);
@@ -102,7 +102,7 @@
OutStream *const dsx_out = self->dsx_out;
DocReader *const doc_reader = reader->doc_reader;
ByteBuf *const buffer = BB_new(0);
- u32_t orig, max;
+ i32_t orig, max;

for (orig = 1, max = SegReader_Max_Docs(reader); orig <= max; orig++) {
if (I32Arr_Get(doc_map, orig)) {

Modified: trunk/c_src/KinoSearch/Index/IndexReader.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/IndexReader.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/IndexReader.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -63,13 +63,13 @@
* been marked as deleted but not yet purged from the index are included
* in this count.
*/
- public abstract u32_t
+ public abstract i32_t
Max_Docs(IndexReader *self);

/** Return the number documents available to the reader, subtracting
* any that are marked as deleted.
*/
- public abstract u32_t
+ public abstract i32_t
Num_Docs(IndexReader *self);

/** Return the number of documents in which the term appears.
@@ -87,7 +87,7 @@
* been deleted.
*/
abstract bool_t
- Is_Deleted(IndexReader *self, u32_t doc_num);
+ Is_Deleted(IndexReader *self, i32_t doc_num);

/** Return true if any documents have been marked as deleted.
*/
@@ -127,12 +127,12 @@
* object. Throws an error if the doc num is out of range.
*/
public abstract incremented HitDoc*
- Fetch_Doc(IndexReader *self, u32_t doc_num);
+ Fetch_Doc(IndexReader *self, i32_t doc_num);

/** Retrieve the DocVector for the given doc num.
*/
abstract incremented DocVector*
- Fetch_Doc_Vec(IndexReader *self, u32_t doc_num);
+ Fetch_Doc_Vec(IndexReader *self, i32_t doc_num);

/** Return an I32Array sort cache for the given field.
*/

Modified: trunk/c_src/KinoSearch/Index/IndexReader.c
===================================================================
--- trunk/c_src/KinoSearch/Index/IndexReader.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/IndexReader.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -231,7 +231,7 @@
/* Acquire the sort cache, if possible. */
lexicon = IxReader_Lexicon(self, field_name, NULL);
if (lexicon != NULL) {
- u32_t max_docs = IxReader_Max_Docs(self);
+ i32_t max_docs = IxReader_Max_Docs(self);
PostingList *plist
= IxReader_Posting_List(self, field_name, NULL);
sort_cache = Lex_Build_Sort_Cache(lexicon, plist, max_docs);

Modified: trunk/c_src/KinoSearch/Index/Lexicon.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/Lexicon.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/Lexicon.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -65,7 +65,7 @@
* Calling this method leaves the iterator in an invalid state.
*/
abstract incremented I32Array*
- Build_Sort_Cache(Lexicon *self, PostingList *posting_list, u32_t max_docs);
+ Build_Sort_Cache(Lexicon *self, PostingList *posting_list, i32_t max_docs);

/** Pretend the Lexicon is an array and seek the iterator to Term at index
* [term_num].

Modified: trunk/c_src/KinoSearch/Index/MultiLexicon.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/MultiLexicon.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/MultiLexicon.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -47,7 +47,7 @@

incremented I32Array*
Build_Sort_Cache(MultiLexicon *self, PostingList *posting_list,
- u32_t max_docs);
+ i32_t max_docs);

void
Seek_By_Num(MultiLexicon *self, i32_t term_num);

Modified: trunk/c_src/KinoSearch/Index/MultiLexicon.c
===================================================================
--- trunk/c_src/KinoSearch/Index/MultiLexicon.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/MultiLexicon.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -159,13 +159,13 @@

I32Array*
MultiLex_build_sort_cache(MultiLexicon *self, PostingList *plist,
- u32_t max_docs)
+ i32_t max_docs)
{
i32_t *ints = MALLOCATE(max_docs + 1, i32_t);
CharBuf *last_term_text = CB_new(0);
CharBuf *term_text_clone;
VArray *term_texts;
- u32_t i;
+ i32_t i;
i32_t index_interval;
SegLexicon *seg_lexicon;


Modified: trunk/c_src/KinoSearch/Index/MultiPostingList.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/MultiPostingList.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/MultiPostingList.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -30,17 +30,17 @@
public u32_t
Get_Doc_Freq(MultiPostingList *self);

- public u32_t
+ public i32_t
Get_Doc_Num(MultiPostingList *self);

- public u32_t
+ public i32_t
Next(MultiPostingList *self);

public void
Seek(MultiPostingList *self, Obj *target);

- u32_t
- Skip_To(MultiPostingList *self, u32_t target);
+ i32_t
+ Skip_To(MultiPostingList *self, i32_t target);

Scorer*
Make_Scorer(MultiPostingList *self, Similarity *similarity,

Modified: trunk/c_src/KinoSearch/Index/MultiPostingList.c
===================================================================
--- trunk/c_src/KinoSearch/Index/MultiPostingList.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/MultiPostingList.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -88,19 +88,19 @@
return SegPList_Get_Posting(self->current);
}

-u32_t
+i32_t
MultiPList_get_doc_num(MultiPostingList *self)
{
return SegPList_Get_Doc_Num(self->current);
}

-u32_t
+i32_t
MultiPList_next(MultiPostingList* self)
{
while (1) {
/* Try current segment. */
if (self->current != NULL) {
- u32_t doc_num = SegPList_Next(self->current);
+ i32_t doc_num = SegPList_Next(self->current);
if (doc_num != 0) {
return doc_num;
}
@@ -118,13 +118,13 @@
}
}

-u32_t
-MultiPList_skip_to(MultiPostingList *self, u32_t target)
+i32_t
+MultiPList_skip_to(MultiPostingList *self, i32_t target)
{
while (1) {
/* Try current segment. */
if (self->current != NULL) {
- u32_t doc_num = SegPList_Skip_To(self->current, target);
+ i32_t doc_num = SegPList_Skip_To(self->current, target);
if (doc_num != 0) {
return doc_num;
}

Modified: trunk/c_src/KinoSearch/Index/MultiReader.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/MultiReader.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/MultiReader.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -6,7 +6,7 @@
class KinoSearch::Index::MultiReader extends KinoSearch::Index::IndexReader {

VArray *sub_readers;
- u32_t max_docs;
+ i32_t max_docs;
I32Array *starts;

static incremented MultiReader*
@@ -17,10 +17,10 @@
init(MultiReader *self, InvIndex *invindex, Snapshot *snapshot = NULL,
LockFactory *lock_factory = NULL, VArray *sub_readers);

- public u32_t
+ public i32_t
Max_Docs(MultiReader *self);

- public u32_t
+ public i32_t
Num_Docs(MultiReader *self);

u32_t
@@ -33,7 +33,7 @@
Has_Deletions(MultiReader *self);

bool_t
- Is_Deleted(MultiReader *self, u32_t doc_num);
+ Is_Deleted(MultiReader *self, i32_t doc_num);

void
Write_Deletions(MultiReader *self);
@@ -46,10 +46,10 @@
Obj *term = NULL);

public incremented HitDoc*
- Fetch_Doc(MultiReader *self, u32_t doc_num);
+ Fetch_Doc(MultiReader *self, i32_t doc_num);

incremented DocVector*
- Fetch_Doc_Vec(MultiReader *self, u32_t doc_num);
+ Fetch_Doc_Vec(MultiReader *self, i32_t doc_num);

incremented I32Array*
Seg_Starts(MultiReader *self);

Modified: trunk/c_src/KinoSearch/Index/MultiReader.c
===================================================================
--- trunk/c_src/KinoSearch/Index/MultiReader.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/MultiReader.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -20,7 +20,7 @@
* needed by binding.)
*/
static u32_t
-sub_reader_tick(MultiReader *self, u32_t doc_num);
+sub_reader_tick(MultiReader *self, i32_t doc_num);

MultiReader*
MultiReader_new(InvIndex *invindex, Snapshot *snapshot,
@@ -52,16 +52,16 @@
return self;
}

-u32_t
+i32_t
MultiReader_max_docs(MultiReader *self)
{
return self->max_docs;
}

-u32_t
+i32_t
MultiReader_num_docs(MultiReader *self)
{
- u32_t retval = 0;
+ i32_t retval = 0;
u32_t i;
for (i = 0; i < self->sub_readers->size; i++) {
SegReader *seg_reader = (SegReader*)VA_Fetch(self->sub_readers, i);
@@ -104,11 +104,11 @@
}

bool_t
-MultiReader_is_deleted(MultiReader *self, u32_t doc_num)
+MultiReader_is_deleted(MultiReader *self, i32_t doc_num)
{
u32_t tick = sub_reader_tick(self, doc_num);
SegReader *sub_reader = (SegReader*)VA_Fetch(self->sub_readers, tick);
- u32_t offset = I32Arr_Get(self->starts, tick);
+ i32_t offset = I32Arr_Get(self->starts, tick);
doc_num -= offset;
return SegReader_Is_Deleted(sub_reader, doc_num);
}
@@ -170,22 +170,22 @@
}

HitDoc*
-MultiReader_fetch_doc(MultiReader *self, u32_t doc_num)
+MultiReader_fetch_doc(MultiReader *self, i32_t doc_num)
{
u32_t tick = sub_reader_tick(self, doc_num);
SegReader *sub_reader = (SegReader*)VA_Fetch(self->sub_readers, tick);
- u32_t offset = I32Arr_Get(self->starts, tick);
+ i32_t offset = I32Arr_Get(self->starts, tick);
HitDoc *doc = SegReader_Fetch_Doc(sub_reader, doc_num - offset);
HitDoc_Set_Doc_Num(doc, doc_num);
return doc;
}

DocVector*
-MultiReader_fetch_doc_vec(MultiReader *self, u32_t doc_num)
+MultiReader_fetch_doc_vec(MultiReader *self, i32_t doc_num)
{
u32_t tick = sub_reader_tick(self, doc_num);
SegReader *sub_reader = (SegReader*)VA_Fetch(self->sub_readers, tick);
- u32_t offset = I32Arr_Get(self->starts, tick);
+ i32_t offset = I32Arr_Get(self->starts, tick);
doc_num -= offset;
return SegReader_Fetch_Doc_Vec(sub_reader, doc_num);
}
@@ -203,7 +203,7 @@
}

static u32_t
-sub_reader_tick(MultiReader *self, u32_t doc_num)
+sub_reader_tick(MultiReader *self, i32_t doc_num)
{
I32Array *const starts = self->starts;
u32_t lo = 0;
@@ -212,9 +212,9 @@
u32_t hi = hi_tick;

while (hi >= lo) {
- u32_t mid_start;
+ i32_t mid_start;
mid = (lo + hi) >> 1;
- mid_start = (u32_t)I32Arr_Get(starts, mid) + 1;
+ mid_start = I32Arr_Get(starts, mid) + 1;
if (doc_num < mid_start) {
hi = mid - 1;
}
@@ -223,7 +223,7 @@
}
else {
while ( mid < hi_tick
- && I32Arr_Get(starts, mid + 1) == (i32_t)mid_start
+ && I32Arr_Get(starts, mid + 1) == mid_start
) {
mid++;
}

Modified: trunk/c_src/KinoSearch/Index/PostingList.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingList.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/PostingList.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -28,7 +28,7 @@
/** Return the iterator's current document number. Should not be called
* before the iterator is initialized or after it empties.
*/
- public abstract u32_t
+ public abstract i32_t
Get_Doc_Num(PostingList *self);

/** Prepare the PostingList object to iterate over matches for documents that
@@ -48,14 +48,14 @@
/** Advance the PostingList object to the next document. Return a positive
* document number, or 0 once the iterator is exhausted.
*/
- public abstract u32_t
+ public abstract i32_t
Next(PostingList *self);

/** Skip to the first doc number greater than or equal to [target]. Return
* the doc number, or 0 once the iterator is exhausted.
*/
- u32_t
- Skip_To(PostingList *self, u32_t target);
+ i32_t
+ Skip_To(PostingList *self, i32_t target);

/** Invoke Post_Make_Scorer for this PostingList's posting.
*/

Modified: trunk/c_src/KinoSearch/Index/PostingList.c
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingList.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/PostingList.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -16,11 +16,11 @@
return self;
}

-u32_t
-PList_skip_to(PostingList *self, u32_t target)
+i32_t
+PList_skip_to(PostingList *self, i32_t target)
{
while (1) {
- u32_t doc_num = PList_Next(self);
+ i32_t doc_num = PList_Next(self);
if (doc_num == 0 || doc_num >= target)
return doc_num;
}

Modified: trunk/c_src/KinoSearch/Index/PostingPool.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingPool.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/PostingPool.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -19,8 +19,8 @@
u64_t lex_end;
u64_t post_end;
u32_t mem_thresh;
- u32_t doc_base;
- u32_t last_doc_num;
+ i32_t doc_base;
+ i32_t last_doc_num;
u32_t post_count;
bool_t flipped;
bool_t from_seg;
@@ -51,7 +51,7 @@
*/
void
Assign_Seg(PostingPool *self, Folder *other_folder,
- SegInfo *other_seg_info, u32_t doc_base,
+ SegInfo *other_seg_info, i32_t doc_base,
I32Array *doc_map = NULL);

/* Iterate through postings currently in RAM. Used when flushing cache to

Modified: trunk/c_src/KinoSearch/Index/PostingPool.c
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingPool.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/PostingPool.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -114,7 +114,7 @@

void
PostPool_assign_seg(PostingPool *self, Folder *other_folder,
- SegInfo *other_seg_info, u32_t doc_base, I32Array *doc_map)
+ 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);
@@ -215,7 +215,7 @@
InStream *const post_instream = self->post_instream;
I32Array *const doc_map = self->doc_map;
const u32_t mem_thresh = self->mem_thresh;
- const u32_t doc_base = self->doc_base;
+ const i32_t doc_base = self->doc_base;
const u64_t lex_end = self->lex_end;
u32_t num_elems = 0; /* number of items recovered */
CharBuf *term_text = lex_stepper->value == NULL

Modified: trunk/c_src/KinoSearch/Index/PostingsWriter.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingsWriter.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/PostingsWriter.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -31,7 +31,7 @@
LexWriter *lex_writer = NULL, u32_t mem_thresh = 0x1000000); /* 16 MiB */

void
- Add(PostingsWriter *self, Inverter *inverter, u32_t doc_num);
+ Add(PostingsWriter *self, Inverter *inverter, i32_t doc_num);

/* Add a field's inverted content.
*/

Modified: trunk/c_src/KinoSearch/Index/PostingsWriter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/PostingsWriter.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/PostingsWriter.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -124,7 +124,7 @@
}

void
-PostWriter_add(PostingsWriter *self, Inverter *inverter, u32_t doc_num)
+PostWriter_add(PostingsWriter *self, Inverter *inverter, i32_t doc_num)
{
Doc *doc = Inverter_Get_Doc(inverter);
float doc_boost = Doc_Get_Boost(doc);
@@ -226,8 +226,8 @@
LexWriter *const lex_writer = self->lex_writer;
const i32_t skip_interval = lex_writer->skip_interval;
CharBuf *const last_term_text = CB_new(0);
- u32_t last_doc_num = 0;
- u32_t last_skip_doc = 0;
+ i32_t last_doc_num = 0;
+ i32_t last_skip_doc = 0;
u64_t last_skip_filepos = 0;
RawPosting *posting = NULL;
fetcher_t fetch = NULL;

Modified: trunk/c_src/KinoSearch/Index/SegDataWriter.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/SegDataWriter.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegDataWriter.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -75,7 +75,7 @@
*/

abstract void
- Add(SegDataWriter *self, Inverter *inverter, u32_t doc_num);
+ Add(SegDataWriter *self, Inverter *inverter, i32_t doc_num);

/** Merge content from an existing segment into the one currently being
* written.

Modified: trunk/c_src/KinoSearch/Index/SegInfo.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/SegInfo.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegInfo.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -16,7 +16,7 @@
class KinoSearch::Index::SegInfo extends KinoSearch::Obj {

CharBuf *seg_name;
- u32_t doc_count;
+ i32_t doc_count;
Hash *by_name; /* field numbers by name */
VArray *by_num; /* field names by num */
Hash *metadata;
@@ -78,16 +78,16 @@
/** Setter for the object's document count.
*/
void
- Set_Doc_Count(SegInfo *self, u32_t count);
+ Set_Doc_Count(SegInfo *self, i32_t count);

/** Getter for the object's document count.
*/
- u32_t
+ i32_t
Get_Doc_Count(SegInfo *self);

/** Add one to the object's document count, then return it.
*/
- u32_t
+ i32_t
Increment_Doc_Count(SegInfo *self);

void

Modified: trunk/c_src/KinoSearch/Index/SegInfo.c
===================================================================
--- trunk/c_src/KinoSearch/Index/SegInfo.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegInfo.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -31,7 +31,7 @@
self->seg_name = CB_Clone(seg_name);
self->doc_count = seg_info_metadata == NULL
? 0
- : (u32_t)Hash_Fetch_I64(seg_info_metadata, "doc_count", 9);
+ : (i32_t)Hash_Fetch_I64(seg_info_metadata, "doc_count", 9);

/* Get list of field nums, either from metadata or fspecs hash. */
if (seg_info_metadata != NULL) {
@@ -101,10 +101,10 @@
CharBuf*
SegInfo_get_seg_name(SegInfo *self) { return self->seg_name; }
void
-SegInfo_set_doc_count(SegInfo *self, u32_t count) { self->doc_count = count; }
-u32_t
+SegInfo_set_doc_count(SegInfo *self, i32_t count) { self->doc_count = count; }
+i32_t
SegInfo_get_doc_count(SegInfo *self) { return self->doc_count; }
-u32_t
+i32_t
SegInfo_increment_doc_count(SegInfo *self) { return ++self->doc_count; }

void

Modified: trunk/c_src/KinoSearch/Index/SegLexicon.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/SegLexicon.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegLexicon.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -65,7 +65,7 @@

incremented I32Array*
Build_Sort_Cache(SegLexicon *self, PostingList *posting_list,
- u32_t max_docs);
+ i32_t max_docs);

void
Seek_By_Num(SegLexicon *self, i32_t term_num);

Modified: trunk/c_src/KinoSearch/Index/SegLexicon.c
===================================================================
--- trunk/c_src/KinoSearch/Index/SegLexicon.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegLexicon.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -216,11 +216,11 @@
}

I32Array*
-SegLex_build_sort_cache(SegLexicon *self, PostingList *plist, u32_t max_docs)
+SegLex_build_sort_cache(SegLexicon *self, PostingList *plist, i32_t max_docs)
{
i32_t *ints = MALLOCATE(max_docs + 1, i32_t);
i32_t term_num = 0;
- u32_t i;
+ i32_t i;

for (i = 0; i <= max_docs; i++) {
ints[i] = -1;

Modified: trunk/c_src/KinoSearch/Index/SegPostingList.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/SegPostingList.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegPostingList.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -14,7 +14,7 @@
InStream *skip_stream;
SkipStepper *skip_stepper;
i32_t skip_interval;
- u32_t doc_base;
+ i32_t doc_base;
u32_t count;
u32_t doc_freq;
u32_t skip_count;
@@ -34,7 +34,7 @@
* This should not be called after Seek.
*/
void
- Set_Doc_Base(SegPostingList *self, u32_t doc_base);
+ Set_Doc_Base(SegPostingList *self, i32_t doc_base);

void
Destroy(SegPostingList *self);
@@ -42,18 +42,18 @@
public u32_t
Get_Doc_Freq(SegPostingList *self);

- public u32_t
+ public i32_t
Get_Doc_Num(SegPostingList *self);

Posting*
Get_Posting(SegPostingList *self);

- public u32_t
+ public i32_t
Next(SegPostingList *self);

/*
- u32_t
- Skip_To(SegPostingList *self, u32_t target);
+ i32_t
+ Skip_To(SegPostingList *self, i32_t target);
*/

public void

Modified: trunk/c_src/KinoSearch/Index/SegPostingList.c
===================================================================
--- trunk/c_src/KinoSearch/Index/SegPostingList.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegPostingList.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -113,7 +113,7 @@
return self->doc_freq;
}

-u32_t
+i32_t
SegPList_get_doc_num(SegPostingList *self)
{
return self->posting->doc_num;
@@ -121,12 +121,12 @@

/* TODO: This is unsafe to call except right after constructor. */
void
-SegPList_set_doc_base(SegPostingList *self, u32_t doc_base)
+SegPList_set_doc_base(SegPostingList *self, i32_t doc_base)
{
self->doc_base = doc_base;
}

-u32_t
+i32_t
SegPList_next(SegPostingList *self)
{
InStream *const post_stream = self->post_stream;
@@ -149,7 +149,7 @@
break;
}
else {
- const u32_t doc_minus_base = posting->doc_num - self->doc_base;
+ const i32_t doc_minus_base = posting->doc_num - self->doc_base;
if ( !DelDocs_Get(deldocs, doc_minus_base) ) {
break;
}
@@ -159,8 +159,8 @@
return posting->doc_num;
}

-u32_t
-SegPList_skip_to(SegPostingList *self, u32_t target)
+i32_t
+SegPList_skip_to(SegPostingList *self, i32_t target)
{
Posting *posting = self->posting;
const u32_t skip_interval = self->skip_interval;
@@ -215,7 +215,7 @@

/* Done skipping, so scan. */
while (1) {
- u32_t doc_num = SegPList_Next(self);
+ i32_t doc_num = SegPList_Next(self);
if (doc_num == 0 || doc_num >= target)
return doc_num;
}

Modified: trunk/c_src/KinoSearch/Index/SegReader.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/SegReader.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegReader.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -25,10 +25,10 @@
SegInfo*
Get_Seg_Info(SegReader *self);

- public u32_t
+ public i32_t
Max_Docs(SegReader *self);

- public u32_t
+ public i32_t
Num_Docs(SegReader *self);

u32_t
@@ -41,7 +41,7 @@
Has_Deletions(SegReader *self);

bool_t
- Is_Deleted(SegReader *self, u32_t doc_num);
+ Is_Deleted(SegReader *self, i32_t doc_num);

void
Write_Deletions(SegReader *self);
@@ -54,10 +54,10 @@
Obj *term = NULL);

public incremented HitDoc*
- Fetch_Doc(SegReader *self, u32_t doc_num);
+ Fetch_Doc(SegReader *self, i32_t doc_num);

incremented DocVector*
- Fetch_Doc_Vec(SegReader *self, u32_t doc_num);
+ Fetch_Doc_Vec(SegReader *self, i32_t doc_num);

incremented I32Array*
Seg_Starts(SegReader *self);

Modified: trunk/c_src/KinoSearch/Index/SegReader.c
===================================================================
--- trunk/c_src/KinoSearch/Index/SegReader.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegReader.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -54,7 +54,7 @@
}

bool_t
-SegReader_is_deleted(SegReader *self, u32_t doc_num)
+SegReader_is_deleted(SegReader *self, i32_t doc_num)
{
return DelDocs_Get(self->deldocs, doc_num);
}
@@ -80,13 +80,13 @@
SegInfo*
SegReader_get_seg_info(SegReader *self) { return self->seg_info; }

-u32_t
+i32_t
SegReader_max_docs(SegReader *self)
{
return self->seg_info->doc_count;
}

-u32_t
+i32_t
SegReader_num_docs(SegReader *self)
{
if (self->delcount == -1) {
@@ -127,19 +127,19 @@
}

HitDoc*
-SegReader_fetch_doc(SegReader *self, u32_t doc_num)
+SegReader_fetch_doc(SegReader *self, i32_t doc_num)
{
if (doc_num == 0 || doc_num > SegReader_Max_Docs(self)) {
- CONFESS("Invalid doc num: %u32", doc_num);
+ CONFESS("Invalid doc num: %i32", doc_num);
}
return DocReader_Fetch_Doc(self->doc_reader, doc_num);
}

DocVector*
-SegReader_fetch_doc_vec(SegReader *self, u32_t doc_num)
+SegReader_fetch_doc_vec(SegReader *self, i32_t doc_num)
{
if (doc_num == 0 || doc_num > SegReader_Max_Docs(self)) {
- CONFESS("Invalid doc num: %u32", doc_num);
+ CONFESS("Invalid doc num: %i32", doc_num);
}
return TVReader_Doc_Vec(self->tv_reader, doc_num);
}

Modified: trunk/c_src/KinoSearch/Index/SegWriter.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/SegWriter.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegWriter.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -30,7 +30,7 @@
TermVectorsWriter *tv_writer = NULL);

void
- Add(SegWriter *self, Inverter *inverter, u32_t doc_num);
+ Add(SegWriter *self, Inverter *inverter, i32_t doc_num);

void
Add_Doc(SegWriter *self, Doc *doc);

Modified: trunk/c_src/KinoSearch/Index/SegWriter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/SegWriter.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SegWriter.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -49,7 +49,7 @@
}

void
-SegWriter_add(SegWriter *self, Inverter *inverter, u32_t doc_num)
+SegWriter_add(SegWriter *self, Inverter *inverter, i32_t doc_num)
{
SegInfo *seg_info = self->seg_info;


Modified: trunk/c_src/KinoSearch/Index/SkipStepper.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/SkipStepper.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SkipStepper.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -2,7 +2,7 @@

class KinoSearch::Index::SkipStepper extends KinoSearch::Util::Stepper {

- u32_t doc_num;
+ i32_t doc_num;
u64_t filepos;

/* Constructor.
@@ -15,13 +15,13 @@

void
Write_Record(SkipStepper *self, OutStream *outstream,
- u32_t last_doc_num, u64_t last_filepos);
+ i32_t last_doc_num, u64_t last_filepos);

/** Set a base document number and a base file position which Read_Record
* will add onto with its deltas.
*/
void
- Reset(SkipStepper *self, u32_t doc_num, u64_t filepos);
+ Reset(SkipStepper *self, i32_t doc_num, u64_t filepos);

incremented CharBuf*
To_String(SkipStepper *self);

Modified: trunk/c_src/KinoSearch/Index/SkipStepper.c
===================================================================
--- trunk/c_src/KinoSearch/Index/SkipStepper.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/SkipStepper.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -21,7 +21,7 @@
}

void
-SkipStepper_reset(SkipStepper *self, u32_t doc_num, u64_t filepos)
+SkipStepper_reset(SkipStepper *self, i32_t doc_num, u64_t filepos)
{
self->doc_num = doc_num;
self->filepos = filepos;
@@ -45,9 +45,9 @@

void
SkipStepper_write_record(SkipStepper *self, OutStream *outstream,
- u32_t last_doc_num, u64_t last_filepos)
+ i32_t last_doc_num, u64_t last_filepos)
{
- const u32_t delta_doc_num = self->doc_num - last_doc_num;
+ const i32_t delta_doc_num = self->doc_num - last_doc_num;
const u64_t delta_filepos = self->filepos - last_filepos;

/* Write delta doc num. */

Modified: trunk/c_src/KinoSearch/Index/TermVectorsWriter.bp
===================================================================
--- trunk/c_src/KinoSearch/Index/TermVectorsWriter.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/TermVectorsWriter.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -21,7 +21,7 @@
TV_Buf(TermVectorsWriter *self, Inversion *inversion);

void
- Add(TermVectorsWriter *self, Inverter *inverter, u32_t doc_num);
+ Add(TermVectorsWriter *self, Inverter *inverter, i32_t doc_num);

void
Add_Segment(TermVectorsWriter *self, SegReader *reader,

Modified: trunk/c_src/KinoSearch/Index/TermVectorsWriter.c
===================================================================
--- trunk/c_src/KinoSearch/Index/TermVectorsWriter.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Index/TermVectorsWriter.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -48,17 +48,17 @@
}

void
-TVWriter_add(TermVectorsWriter *self, Inverter *inverter, u32_t doc_num)
+TVWriter_add(TermVectorsWriter *self, Inverter *inverter, i32_t doc_num)
{
OutStream *tv_out = self->tv_out;
OutStream *tvx_out = self->tvx_out;
i64_t filepos = OutStream_Tell(tv_out);
u32_t num_vectorized = 0;
- u32_t expected = OutStream_Tell(tvx_out) / 16;
+ i32_t expected = OutStream_Tell(tvx_out) / 16;

/* Verify doc num. */
if (doc_num != expected)
- CONFESS("Expected doc num %u32 but got %u32", expected, doc_num);
+ CONFESS("Expected doc num %i32 but got %i32", expected, doc_num);

/* Count, then write number of vectorized fields. */
Inverter_Iter_Init(inverter);
@@ -157,14 +157,14 @@
TVWriter_add_segment(TermVectorsWriter *self, SegReader *reader,
I32Array *doc_map)
{
- u32_t max_docs = SegReader_Max_Docs(reader);
+ i32_t max_docs = SegReader_Max_Docs(reader);
/* Bail if the supplied segment is empty. */
if (max_docs == 0) {
return;
}
else {
TermVectorsReader *tv_reader = reader->tv_reader;
- u32_t orig;
+ i32_t orig;
ByteBuf *bb = BB_new(0);
OutStream *tv_out = self->tv_out;
OutStream *tvx_out = self->tvx_out;

Modified: trunk/c_src/KinoSearch/Posting/MatchPosting.bp
===================================================================
--- trunk/c_src/KinoSearch/Posting/MatchPosting.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting/MatchPosting.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -23,7 +23,7 @@
init(MatchPosting *self, Similarity *similarity);

void
- Reset(MatchPosting *self, u32_t doc_num);
+ Reset(MatchPosting *self, i32_t doc_num);

public incremented MatchPostingScorer*
Make_Scorer(MatchPosting *self, Similarity *sim, PostingList *plist,

Modified: trunk/c_src/KinoSearch/Posting/MatchPosting.c
===================================================================
--- trunk/c_src/KinoSearch/Posting/MatchPosting.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting/MatchPosting.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -28,7 +28,7 @@
}

void
-MatchPost_reset(MatchPosting *self, u32_t doc_num)
+MatchPost_reset(MatchPosting *self, i32_t doc_num)
{
self->doc_num = doc_num;
}

Modified: trunk/c_src/KinoSearch/Posting/RawPosting.bp
===================================================================
--- trunk/c_src/KinoSearch/Posting/RawPosting.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting/RawPosting.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -31,13 +31,13 @@
/** Constructor. Uses pre-allocated memory.
*/
static incremented RawPosting*
- new(void *pre_allocated_memory, u32_t doc_num, u32_t freq,
+ new(void *pre_allocated_memory, i32_t doc_num, u32_t freq,
char *term_text, size_t term_text_len);

/** Write the posting's doc num and auxilliary content to the outstream.
*/
void
- Write_Record(RawPosting *self, OutStream *outstream, u32_t last_doc_num);
+ Write_Record(RawPosting *self, OutStream *outstream, i32_t last_doc_num);

u32_t
Get_RefCount(RawPosting* self);

Modified: trunk/c_src/KinoSearch/Posting/RawPosting.c
===================================================================
--- trunk/c_src/KinoSearch/Posting/RawPosting.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting/RawPosting.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -18,7 +18,7 @@


RawPosting*
-RawPost_new(void *pre_allocated_memory, u32_t doc_num, u32_t freq,
+RawPost_new(void *pre_allocated_memory, i32_t doc_num, u32_t freq,
char *term_text, size_t term_text_len)
{
RawPosting *self = (RawPosting*)pre_allocated_memory;
@@ -61,7 +61,7 @@

void
RawPost_write_record(RawPosting *self, OutStream *outstream,
- u32_t last_doc_num)
+ i32_t last_doc_num)
{
const u32_t delta_doc = self->doc_num - last_doc_num;
char *const aux_content = self->blob + self->content_len;

Modified: trunk/c_src/KinoSearch/Posting/RichPosting.bp
===================================================================
--- trunk/c_src/KinoSearch/Posting/RichPosting.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting/RichPosting.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -32,13 +32,13 @@
Read_Record(RichPosting *self, InStream *instream);

incremented RawPosting*
- Read_Raw(RichPosting *self, InStream *instream, u32_t last_doc_num,
+ Read_Raw(RichPosting *self, InStream *instream, i32_t last_doc_num,
CharBuf *term_text, MemoryPool *mem_pool);

void
Add_Inversion_To_Pool(RichPosting *self, PostingPool *post_pool,
Inversion *inversion, FieldSpec *fspec,
- u32_t doc_num, float doc_boost,
+ i32_t doc_num, float doc_boost,
float length_norm);

public incremented RichPostingScorer*

Modified: trunk/c_src/KinoSearch/Posting/RichPosting.c
===================================================================
--- trunk/c_src/KinoSearch/Posting/RichPosting.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting/RichPosting.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -113,7 +113,7 @@
void
RichPost_add_inversion_to_pool(RichPosting *self, PostingPool *post_pool,
Inversion *inversion, FieldSpec *fspec,
- u32_t doc_num, float doc_boost,
+ i32_t doc_num, float doc_boost,
float length_norm)
{
MemoryPool *mem_pool = post_pool->mem_pool;
@@ -157,13 +157,13 @@
}

RawPosting*
-RichPost_read_raw(RichPosting *self, InStream *instream, u32_t last_doc_num,
+RichPost_read_raw(RichPosting *self, InStream *instream, i32_t last_doc_num,
CharBuf *term_text, MemoryPool *mem_pool)
{
const size_t text_size = CB_Get_Size(term_text);
const u32_t doc_code = InStream_Read_C32(instream);
const u32_t delta_doc = doc_code >> 1;
- const u32_t doc_num = last_doc_num + delta_doc;
+ const i32_t doc_num = last_doc_num + delta_doc;
const u32_t freq = (doc_code & 1)
? 1
: InStream_Read_C32(instream);

Modified: trunk/c_src/KinoSearch/Posting/ScorePosting.bp
===================================================================
--- trunk/c_src/KinoSearch/Posting/ScorePosting.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting/ScorePosting.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -30,17 +30,17 @@
Read_Record(ScorePosting *self, InStream *instream);

incremented RawPosting*
- Read_Raw(ScorePosting *self, InStream *instream, u32_t last_doc_num,
+ Read_Raw(ScorePosting *self, InStream *instream, i32_t last_doc_num,
CharBuf *term_text, MemoryPool *mem_pool);

void
Add_Inversion_To_Pool(ScorePosting *self, PostingPool *post_pool,
Inversion *inversion, FieldSpec *fspec,
- u32_t doc_num, float doc_boost,
+ i32_t doc_num, float doc_boost,
float length_norm);

void
- Reset(ScorePosting *self, u32_t doc_num);
+ Reset(ScorePosting *self, i32_t doc_num);

public incremented ScorePostingScorer*
Make_Scorer(ScorePosting *self, Similarity *sim, PostingList *plist,

Modified: trunk/c_src/KinoSearch/Posting/ScorePosting.c
===================================================================
--- trunk/c_src/KinoSearch/Posting/ScorePosting.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting/ScorePosting.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -72,7 +72,7 @@
void
ScorePost_add_inversion_to_pool(ScorePosting *self, PostingPool *post_pool,
Inversion *inversion, FieldSpec *fspec,
- u32_t doc_num, float doc_boost,
+ i32_t doc_num, float doc_boost,
float length_norm)
{
MemoryPool *mem_pool = post_pool->mem_pool;
@@ -116,7 +116,7 @@
}

void
-ScorePost_reset(ScorePosting *self, u32_t doc_num)
+ScorePost_reset(ScorePosting *self, i32_t doc_num)
{
self->doc_num = doc_num;
self->freq = 0;
@@ -156,13 +156,13 @@
}

RawPosting*
-ScorePost_read_raw(ScorePosting *self, InStream *instream, u32_t last_doc_num,
+ScorePost_read_raw(ScorePosting *self, InStream *instream, i32_t last_doc_num,
CharBuf *term_text, MemoryPool *mem_pool)
{
const size_t text_size = CB_Get_Size(term_text);
const u32_t doc_code = InStream_Read_C32(instream);
const u32_t delta_doc = doc_code >> 1;
- const u32_t doc_num = last_doc_num + delta_doc;
+ const i32_t doc_num = last_doc_num + delta_doc;
const u32_t freq = (doc_code & 1)
? 1
: InStream_Read_C32(instream);

Modified: trunk/c_src/KinoSearch/Posting.bp
===================================================================
--- trunk/c_src/KinoSearch/Posting.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Posting.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -12,7 +12,7 @@
*/
class KinoSearch::Posting cnick Post extends KinoSearch::Util::Stepper {

- u32_t doc_num; /* document number */
+ i32_t doc_num;

public static Posting*
init(Posting *self);
@@ -22,7 +22,7 @@
* Updates the state of the document number, but nothing else.
*/
abstract incremented RawPosting*
- Read_Raw(Posting *self, InStream *instream, u32_t last_doc_num,
+ Read_Raw(Posting *self, InStream *instream, i32_t last_doc_num,
CharBuf *term_text, MemoryPool *mem_pool);

/** Process an Inversion into RawPosting objects and add them all to the
@@ -31,13 +31,13 @@
abstract void
Add_Inversion_To_Pool(Posting *self, PostingPool *post_pool,
Inversion *inversion, FieldSpec *fspec,
- u32_t doc_num, float doc_boost,
+ i32_t doc_num, float doc_boost,
float length_norm);

/** Prepare the posting to start reading after a seek.
*/
abstract void
- Reset(Posting *self, u32_t doc_num);
+ Reset(Posting *self, i32_t doc_num);

/** Factory method for creating a Scorer.
*/

Modified: trunk/c_src/KinoSearch/Search/ANDScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/ANDScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/ANDScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -28,16 +28,16 @@
void
Add_Subscorer(ANDScorer* self, Scorer* subscorer);

- public u32_t
+ public i32_t
Next(ANDScorer *self);

- public u32_t
- Skip_To(ANDScorer *self, u32_t target);
+ public i32_t
+ Skip_To(ANDScorer *self, i32_t target);

public Tally*
Tally(ANDScorer *self);

- public u32_t
+ public i32_t
Get_Doc_Num(ANDScorer *self);

u32_t

Modified: trunk/c_src/KinoSearch/Search/ANDScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/ANDScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/ANDScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -8,12 +8,12 @@
/* Perform some initialization stuff we can't know until all subscorers have
* been added. Return false if we'll never match anything with this scorer.
*/
-static u32_t
-delayed_init(ANDScorer *self, u32_t target);
+static i32_t
+delayed_init(ANDScorer *self, i32_t target);

/* Mark this scorer as invalid/finished.
*/
-static u32_t
+static i32_t
invalidate(ANDScorer *self);

ANDScorer*
@@ -71,10 +71,10 @@
self->tally->num_matchers += 1;
}

-static u32_t
-delayed_init(ANDScorer *self, u32_t target)
+static i32_t
+delayed_init(ANDScorer *self, i32_t target)
{
- u32_t highest = 0;
+ i32_t highest = 0;
u32_t i;

/* Once is enough. */
@@ -92,7 +92,7 @@

/* Advance all scorers. */
for (i = 0; i < self->num_subs; i++) {
- u32_t candidate = Scorer_Skip_To(self->subscorers[i], target);
+ i32_t candidate = Scorer_Skip_To(self->subscorers[i], target);
if (!candidate)
return invalidate(self);
else if (candidate > highest)
@@ -102,14 +102,14 @@
return highest;
}

-u32_t
+i32_t
ANDScorer_next(ANDScorer *self)
{
if (self->first_time) {
return Scorer_Skip_To(self, 0);
}
else if (self->more) {
- const u32_t target = Scorer_Get_Doc_Num(self->subscorers[0]) + 1;
+ const i32_t target = Scorer_Get_Doc_Num(self->subscorers[0]) + 1;
return Scorer_Skip_To(self, target);
}
else {
@@ -117,19 +117,19 @@
}
}

-static u32_t
+static i32_t
invalidate(ANDScorer *self)
{
self->more = false;
return 0;
}

-u32_t
-ANDScorer_skip_to(ANDScorer *self, u32_t target)
+i32_t
+ANDScorer_skip_to(ANDScorer *self, i32_t target)
{
Scorer **const subscorers = self->subscorers;
const u32_t num_subs = self->num_subs;
- u32_t highest = 0;
+ i32_t highest = 0;

/* First step: advance. */
if (self->first_time) {
@@ -153,7 +153,7 @@
/* Scoot all scorers up. */
for (i = 0; i < num_subs; i++) {
Scorer *const subscorer = subscorers[i];
- u32_t candidate = Scorer_Get_Doc_Num(subscorer);
+ i32_t candidate = Scorer_Get_Doc_Num(subscorer);

/* If this subscorer is highest, others will need to catch up. */
if (highest < candidate)
@@ -175,7 +175,7 @@
/* If scorers don't agree, send back through the loop. */
for (i = 0; i < num_subs; i++) {
Scorer *const subscorer = subscorers[i];
- const u32_t candidate = Scorer_Get_Doc_Num(subscorer);
+ const i32_t candidate = Scorer_Get_Doc_Num(subscorer);
if (candidate != highest) {
agreement = false;
break;
@@ -191,7 +191,7 @@
return highest;
}

-u32_t
+i32_t
ANDScorer_get_doc_num(ANDScorer *self)
{
return Scorer_Get_Doc_Num(self->subscorers[0]);

Modified: trunk/c_src/KinoSearch/Search/FieldDoc.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/FieldDoc.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/FieldDoc.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -5,10 +5,10 @@
FieldDocCollator *collator;

static incremented FieldDoc*
- new(u32_t doc_num, float score, FieldDocCollator *collator);
+ new(i32_t doc_num, float score, FieldDocCollator *collator);

static FieldDoc*
- init(FieldDoc *self, u32_t doc_num, float score, FieldDocCollator *collator);
+ init(FieldDoc *self, i32_t doc_num, float score, FieldDocCollator *collator);

void
Destroy(FieldDoc *self);

Modified: trunk/c_src/KinoSearch/Search/FieldDoc.c
===================================================================
--- trunk/c_src/KinoSearch/Search/FieldDoc.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/FieldDoc.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -4,14 +4,14 @@
#include "KinoSearch/Search/FieldDocCollator.h"

FieldDoc*
-FieldDoc_new(u32_t doc_num, float score, FieldDocCollator *collator)
+FieldDoc_new(i32_t doc_num, float score, FieldDocCollator *collator)
{
FieldDoc *self = (FieldDoc*)CREATE(NULL, FIELDDOC);
return FieldDoc_init(self, doc_num, score, collator);
}

FieldDoc*
-FieldDoc_init(FieldDoc *self, u32_t doc_num, float score,
+FieldDoc_init(FieldDoc *self, i32_t doc_num, float score,
FieldDocCollator *collator)
{
/* Assign. */

Modified: trunk/c_src/KinoSearch/Search/HitCollector/SortCollector.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/HitCollector/SortCollector.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/HitCollector/SortCollector.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -16,7 +16,7 @@
init(SortCollector *self, FieldDocCollator *collator, u32_t size);

public void
- Collect(SortCollector *self, u32_t doc_num, Tally *tally);
+ Collect(SortCollector *self, i32_t doc_num, Tally *tally);

void
Destroy(SortCollector *self);

Modified: trunk/c_src/KinoSearch/Search/HitCollector/SortCollector.c
===================================================================
--- trunk/c_src/KinoSearch/Search/HitCollector/SortCollector.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/HitCollector/SortCollector.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -44,7 +44,7 @@
}

void
-SortColl_collect(SortCollector *self, u32_t doc_num, Tally *tally)
+SortColl_collect(SortCollector *self, i32_t doc_num, Tally *tally)
{
/* Add to the total number of hits. */
self->total_hits++;

Modified: trunk/c_src/KinoSearch/Search/HitCollector/TopDocCollector.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/HitCollector/TopDocCollector.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/HitCollector/TopDocCollector.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -23,7 +23,7 @@
/** Keep highest scoring docs.
*/
public void
- Collect(TopDocCollector *self, u32_t doc_num, Tally *tally);
+ Collect(TopDocCollector *self, i32_t doc_num, Tally *tally);

void
Destroy(TopDocCollector *self);

Modified: trunk/c_src/KinoSearch/Search/HitCollector/TopDocCollector.c
===================================================================
--- trunk/c_src/KinoSearch/Search/HitCollector/TopDocCollector.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/HitCollector/TopDocCollector.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -38,7 +38,7 @@
}

void
-TDColl_collect(TopDocCollector *self, u32_t doc_num, Tally *tally)
+TDColl_collect(TopDocCollector *self, i32_t doc_num, Tally *tally)
{
/* Add to the total number of hits. */
self->total_hits++;

Modified: trunk/c_src/KinoSearch/Search/HitCollector.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/HitCollector.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/HitCollector.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -17,12 +17,12 @@
/** Do something with a doc num and a Tally. (For instance,
* keep track of the docs with the ten highest scores.)
*
- * @param doc_num A positive integer document number.
+ * @param doc_num A document number.
* @param tally A KinoSearch::Search::Tally (which communicates scoring
* data).
*/
public abstract void
- Collect(HitCollector *self, u32_t doc_num, Tally *tally);
+ Collect(HitCollector *self, i32_t doc_num, Tally *tally);
}

/** HitCollector which records doc nums in a BitVector.
@@ -49,30 +49,30 @@
* Scoring information is discarded.
*/
public void
- Collect(BitCollector *self, u32_t doc_num, Tally *tally);
+ Collect(BitCollector *self, i32_t doc_num, Tally *tally);
}

class KinoSearch::Search::HitCollector::OffsetCollector cnick OffsetColl
extends KinoSearch::Search::HitCollector {

- u32_t offset;
+ i32_t offset;
HitCollector *inner_coll;

static incremented OffsetCollector*
- new(HitCollector *collector, u32_t offset);
+ new(HitCollector *collector, i32_t offset);

/** Wrap another HitCollector, adding a constant offset to each document
* number. Useful when combining results from multiple independent
* indexes.
*/
static OffsetCollector*
- init(OffsetCollector *self, HitCollector *collector, u32_t offset);
+ init(OffsetCollector *self, HitCollector *collector, i32_t offset);

void
Destroy(OffsetCollector *self);

public void
- Collect(OffsetCollector *self, u32_t doc_num, Tally *tally);
+ Collect(OffsetCollector *self, i32_t doc_num, Tally *tally);
}

/* Copyright 2006-2008 Marvin Humphrey

Modified: trunk/c_src/KinoSearch/Search/HitCollector.c
===================================================================
--- trunk/c_src/KinoSearch/Search/HitCollector.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/HitCollector.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -28,7 +28,7 @@
}

void
-BitColl_collect(BitCollector *self, u32_t doc_num, Tally *tally)
+BitColl_collect(BitCollector *self, i32_t doc_num, Tally *tally)
{
UNUSED_VAR(tally);

@@ -44,14 +44,14 @@
}

OffsetCollector*
-OffsetColl_new(HitCollector *inner_coll, u32_t offset)
+OffsetColl_new(HitCollector *inner_coll, i32_t offset)
{
OffsetCollector *self = (OffsetCollector*)CREATE(NULL, OFFSETCOLLECTOR);
return OffsetColl_init(self, inner_coll, offset);
}

OffsetCollector*
-OffsetColl_init(OffsetCollector *self, HitCollector *inner_coll, u32_t offset)
+OffsetColl_init(OffsetCollector *self, HitCollector *inner_coll, i32_t offset)
{
self->offset = offset;
self->inner_coll = REFCOUNT_INC(inner_coll);
@@ -59,7 +59,7 @@
}

void
-OffsetColl_collect(OffsetCollector *self, u32_t doc_num, Tally *tally)
+OffsetColl_collect(OffsetCollector *self, i32_t doc_num, Tally *tally)
{
HC_Collect(self->inner_coll, (doc_num + self->offset), tally);
}

Modified: trunk/c_src/KinoSearch/Search/MatchAllScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/MatchAllScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/MatchAllScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -2,8 +2,8 @@

class KinoSearch::Search::MatchAllScorer extends KinoSearch::Search::Scorer {

- u32_t doc_num;
- u32_t max_docs;
+ i32_t doc_num;
+ i32_t max_docs;
IndexReader *reader;
Tally *tally;

@@ -20,16 +20,16 @@
void
Destroy(MatchAllScorer *self);

- public u32_t
+ public i32_t
Next(MatchAllScorer* self);

- public u32_t
- Skip_To(MatchAllScorer* self, u32_t target);
+ public i32_t
+ Skip_To(MatchAllScorer* self, i32_t target);

public Tally*
Tally(MatchAllScorer* self);

- public u32_t
+ public i32_t
Get_Doc_Num(MatchAllScorer* self);
}


Modified: trunk/c_src/KinoSearch/Search/MatchAllScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/MatchAllScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/MatchAllScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -44,7 +44,7 @@
Scorer_destroy((Scorer*)self);
}

-u32_t
+i32_t
MatchAllScorer_next(MatchAllScorer* self)
{
do {
@@ -57,8 +57,8 @@
return self->doc_num;
}

-u32_t
-MatchAllScorer_skip_to(MatchAllScorer* self, u32_t target)
+i32_t
+MatchAllScorer_skip_to(MatchAllScorer* self, i32_t target)
{
self->doc_num = target - 1;
return MatchAllScorer_next(self);
@@ -70,7 +70,7 @@
return self->tally;
}

-u32_t
+i32_t
MatchAllScorer_get_doc_num(MatchAllScorer* self)
{
return self->doc_num;

Modified: trunk/c_src/KinoSearch/Search/MultiSearcher.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/MultiSearcher.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/MultiSearcher.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -19,7 +19,7 @@

VArray *searchables;
I32Array *starts;
- u32_t max_docs;
+ i32_t max_docs;

static incremented MultiSearcher*
new(Schema *schema, VArray *searchables);
@@ -34,7 +34,7 @@
void
Destroy(MultiSearcher *self);

- public u32_t
+ public i32_t
Max_Docs(MultiSearcher *self);

public u32_t
@@ -48,10 +48,10 @@
SortSpec *sort_spec = NULL);

public incremented HitDoc*
- Fetch_Doc(MultiSearcher *self, u32_t doc_num);
+ Fetch_Doc(MultiSearcher *self, i32_t doc_num);

incremented DocVector*
- Fetch_Doc_Vec(MultiSearcher *self, u32_t doc_num);
+ Fetch_Doc_Vec(MultiSearcher *self, i32_t doc_num);
}

/* Copyright 2006-2008 Marvin Humphrey

Modified: trunk/c_src/KinoSearch/Search/MultiSearcher.c
===================================================================
--- trunk/c_src/KinoSearch/Search/MultiSearcher.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/MultiSearcher.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -26,7 +26,7 @@
{
u32_t i;
i32_t *starts_array = MALLOCATE(searchables->size, i32_t);
- u32_t max_docs = 0;
+ i32_t max_docs = 0;

Searchable_init((Searchable*)self, schema);
self->searchables = REFCOUNT_INC(searchables);
@@ -71,13 +71,13 @@
}

static u32_t
-subsearcher_tick(MultiSearcher *self, u32_t doc_num)
+subsearcher_tick(MultiSearcher *self, i32_t doc_num)
{
I32Array *starts = self->starts;
u32_t max = I32Arr_Get_Size(starts);
u32_t tick;
for (tick = 1; tick < max; tick++) {
- if ((u32_t)I32Arr_Get(starts, tick) > doc_num) {
+ if (I32Arr_Get(starts, tick) > doc_num) {
return tick - 1;
}
}
@@ -85,28 +85,28 @@
}

HitDoc*
-MultiSearcher_fetch_doc(MultiSearcher *self, u32_t doc_num)
+MultiSearcher_fetch_doc(MultiSearcher *self, i32_t doc_num)
{
u32_t tick = subsearcher_tick(self, doc_num);
Searchable *searchable = (Searchable*)VA_Fetch(self->searchables, tick);
- u32_t start = I32Arr_Get(self->starts, tick);
- u32_t sub_doc = doc_num - start;
+ i32_t start = I32Arr_Get(self->starts, tick);
+ i32_t sub_doc = doc_num - start;
HitDoc *doc = Searchable_Fetch_Doc(searchable, sub_doc);
HitDoc_Set_Doc_Num(doc, doc_num);
return doc;
}

DocVector*
-MultiSearcher_fetch_doc_vec(MultiSearcher *self, u32_t doc_num)
+MultiSearcher_fetch_doc_vec(MultiSearcher *self, i32_t doc_num)
{
u32_t tick = subsearcher_tick(self, doc_num);
Searchable *searchable = (Searchable*)VA_Fetch(self->searchables, tick);
- u32_t start = I32Arr_Get(self->starts, tick);
- u32_t sub_doc = doc_num - start;
+ i32_t start = I32Arr_Get(self->starts, tick);
+ i32_t sub_doc = doc_num - start;
return Searchable_Fetch_Doc_Vec(searchable, sub_doc);
}

-u32_t
+i32_t
MultiSearcher_max_docs(MultiSearcher *self)
{
return self->max_docs;
@@ -125,12 +125,12 @@
}

static void
-modify_doc_nums(VArray *score_docs, u32_t base)
+modify_doc_nums(VArray *score_docs, i32_t base)
{
u32_t i;
for (i = 0; i < score_docs->size; i++) {
ScoreDoc *score_doc = (ScoreDoc*)VA_Fetch(score_docs, i);
- u32_t new_doc_num = ScoreDoc_Get_Doc_Num(score_doc) + base;
+ i32_t new_doc_num = ScoreDoc_Get_Doc_Num(score_doc) + base;
ScoreDoc_Set_Doc_Num(score_doc, new_doc_num);
}
}
@@ -158,7 +158,7 @@

for (i = 0; i < searchables->size; i++) {
Searchable *searchable = (Searchable*)VA_Fetch(searchables, i);
- u32_t base = (u32_t)I32Arr_Get(starts, i);
+ i32_t base = I32Arr_Get(starts, i);
TopDocs *top_docs = Searchable_Top_Docs(searchable,
(Query*)compiler, num_wanted, sort_spec);

@@ -221,7 +221,7 @@
I32Array *starts = self->starts;

for (i = 0; i < searchables->size; i++) {
- u32_t start = (u32_t)I32Arr_Get(starts, i);
+ i32_t start = I32Arr_Get(starts, i);
Searchable *searchable = (Searchable*)VA_Fetch(searchables, i);
OffsetCollector *offset_coll = OffsetColl_new(collector, start);
Searchable_Collect(searchable, query, (HitCollector*)offset_coll);

Modified: trunk/c_src/KinoSearch/Search/NOTScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/NOTScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/NOTScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -8,9 +8,9 @@
Scorer *negated_scorer;
IndexReader *reader;
Tally *tally;
- u32_t doc_num;
- u32_t max_docs;
- u32_t next_negation;
+ i32_t doc_num;
+ i32_t max_docs;
+ i32_t next_negation;

static incremented NOTScorer*
new(Scorer* negated_scorer, IndexReader *reader);
@@ -21,16 +21,16 @@
void
Destroy(NOTScorer *self);

- public u32_t
+ public i32_t
Next(NOTScorer *self);

- public u32_t
- Skip_To(NOTScorer *self, u32_t target);
+ public i32_t
+ Skip_To(NOTScorer *self, i32_t target);

public Tally*
Tally(NOTScorer *self);

- public u32_t
+ public i32_t
Get_Doc_Num(NOTScorer *self);

u32_t

Modified: trunk/c_src/KinoSearch/Search/NOTScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/NOTScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/NOTScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -45,7 +45,7 @@
Scorer_destroy((Scorer*)self);
}

-u32_t
+i32_t
NOTScorer_next(NOTScorer *self)
{
while (1) {
@@ -77,14 +77,14 @@
}
}

-u32_t
-NOTScorer_skip_to(NOTScorer *self, u32_t target)
+i32_t
+NOTScorer_skip_to(NOTScorer *self, i32_t target)
{
self->doc_num = target - 1;
return NOTScorer_next(self);
}

-u32_t
+i32_t
NOTScorer_get_doc_num(NOTScorer *self)
{
return self->doc_num;

Modified: trunk/c_src/KinoSearch/Search/NoMatchScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/NoMatchScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/NoMatchScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -8,11 +8,11 @@
static NoMatchScorer*
init(NoMatchScorer *self);

- public u32_t
+ public i32_t
Next(NoMatchScorer* self);

- public u32_t
- Skip_To(NoMatchScorer* self, u32_t target);
+ public i32_t
+ Skip_To(NoMatchScorer* self, i32_t target);
}

/* Copyright 2008 Marvin Humphrey

Modified: trunk/c_src/KinoSearch/Search/NoMatchScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/NoMatchScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/NoMatchScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -20,15 +20,15 @@
return (NoMatchScorer*)Scorer_init((Scorer*)self, NULL);
}

-u32_t
+i32_t
NoMatchScorer_next(NoMatchScorer* self)
{
UNUSED_VAR(self);
return 0;
}

-u32_t
-NoMatchScorer_skip_to(NoMatchScorer* self, u32_t target)
+i32_t
+NoMatchScorer_skip_to(NoMatchScorer* self, i32_t target)
{
UNUSED_VAR(self);
UNUSED_VAR(target);

Modified: trunk/c_src/KinoSearch/Search/ORScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/ORScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/ORScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -14,7 +14,7 @@
ScorerDocQueue *q;
u32_t num_subs;
float *scores;
- u32_t doc_num;
+ i32_t doc_num;

/* Constructors/initializers.
*/
@@ -27,16 +27,16 @@
void
Destroy(ORScorer *self);

- public u32_t
+ public i32_t
Next(ORScorer *self);

- public u32_t
- Skip_To(ORScorer *self, u32_t target);
+ public i32_t
+ Skip_To(ORScorer *self, i32_t target);

public Tally*
Tally(ORScorer *self);

- public u32_t
+ public i32_t
Get_Doc_Num(ORScorer *self);

u32_t

Modified: trunk/c_src/KinoSearch/Search/ORScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/ORScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/ORScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -12,7 +12,7 @@
* are advancing, their scores are cached in an array, to be summed during
* Tally().
*/
-static u32_t
+static i32_t
advance_after_current(ORScorer *self);

ORScorer*
@@ -63,13 +63,13 @@
Scorer_destroy((Scorer*)self);
}

-u32_t
+i32_t
ORScorer_next(ORScorer *self)
{
return advance_after_current(self);
}

-static u32_t
+static i32_t
advance_after_current(ORScorer *self) {
ScorerDocQueue *const q = self->q;
float *const scores = self->scores;
@@ -89,7 +89,7 @@

do {
/* Attempt to advance past current doc. */
- u32_t top_doc_num = Kino_ScorerDocQ_Top_Next(q);
+ i32_t top_doc_num = Kino_ScorerDocQ_Top_Next(q);
if (!top_doc_num) {
if (!SCORERDOCQ_SIZE(q))
break; /* bail, no more to advance */
@@ -110,8 +110,8 @@
return self->doc_num;
}

-u32_t
-ORScorer_skip_to(ORScorer *self, u32_t target)
+i32_t
+ORScorer_skip_to(ORScorer *self, i32_t target)
{
ScorerDocQueue *const q = self->q;

@@ -137,7 +137,7 @@
} while (true);
}

-chy_u32_t
+i32_t
ORScorer_get_doc_num(ORScorer *self)
{
return self->doc_num;

Modified: trunk/c_src/KinoSearch/Search/PhraseScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/PhraseScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/PhraseScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -5,7 +5,7 @@

class KinoSearch::Search::PhraseScorer extends KinoSearch::Search::Scorer {

- u32_t doc_num;
+ i32_t doc_num;
u32_t num_elements;
Tally *tally;
PostingList **plists;
@@ -27,13 +27,13 @@
void
Destroy(PhraseScorer *self);

- public u32_t
+ public i32_t
Next(PhraseScorer *self);

- public u32_t
- Skip_To(PhraseScorer *self, u32_t target);
+ public i32_t
+ Skip_To(PhraseScorer *self, i32_t target);

- public u32_t
+ public i32_t
Get_Doc_Num(PhraseScorer *self);

public Tally*

Modified: trunk/c_src/KinoSearch/Search/PhraseScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/PhraseScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/PhraseScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -10,7 +10,7 @@

/* Mark this scorer as invalid/finished.
*/
-static u32_t
+static i32_t
invalidate(PhraseScorer *self);

PhraseScorer*
@@ -73,21 +73,21 @@
Scorer_destroy((Scorer*)self);
}

-static u32_t
+static i32_t
invalidate(PhraseScorer *self)
{
self->more = false;
return 0;
}

-u32_t
+i32_t
PhraseScorer_next(PhraseScorer *self)
{
if (self->first_time) {
return Scorer_Skip_To(self, 1);
}
else if (self->more) {
- const u32_t target = PList_Get_Doc_Num(self->plists[0]) + 1;
+ const i32_t target = PList_Get_Doc_Num(self->plists[0]) + 1;
return Scorer_Skip_To(self, target);
}
else {
@@ -95,18 +95,20 @@
}
}

-u32_t
-PhraseScorer_skip_to(PhraseScorer *self, u32_t target)
+i32_t
+PhraseScorer_skip_to(PhraseScorer *self, i32_t target)
{
PostingList **const plists = self->plists;
const u32_t num_elements = self->num_elements;
- u32_t highest = 0;
+ i32_t highest = 0;

self->phrase_freq = 0.0;
self->doc_num = 0;

if (self->first_time) {
- u32_t candidate, i;
+ i32_t candidate;
+ u32_t i;
+
self->first_time = false;
/* Advance all posting lists. */
for (i = 0; i < num_elements; i++) {
@@ -132,7 +134,7 @@
/* Scoot all posting lists up. */
for (i = 0; i < num_elements; i++) {
PostingList *const plist = plists[i];
- u32_t candidate = PList_Get_Doc_Num(plist);
+ i32_t candidate = PList_Get_Doc_Num(plist);

/* Maybe raise the bar. */
if (highest < candidate)
@@ -152,7 +154,7 @@
/* If posting lists don't agree, send back through the loop. */
for (i = 0; i < num_elements; i++) {
PostingList *const plist = plists[i];
- const u32_t candidate = PList_Get_Doc_Num(plist);
+ const i32_t candidate = PList_Get_Doc_Num(plist);
if (candidate != highest)
agreement = false;
}
@@ -258,7 +260,7 @@
return (float)anchors_remaining;
}

-u32_t
+i32_t
PhraseScorer_get_doc_num(PhraseScorer *self)
{
return self->doc_num;

Modified: trunk/c_src/KinoSearch/Search/RangeScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/RangeScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/RangeScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -2,8 +2,8 @@

class KinoSearch::Search::RangeScorer extends KinoSearch::Search::Scorer {

- u32_t doc_num;
- u32_t max_docs;
+ i32_t doc_num;
+ i32_t max_docs;
i32_t lower_bound;
i32_t upper_bound;
I32Array *sort_cache;
@@ -16,16 +16,16 @@
init(RangeScorer *self, i32_t lower_bound, i32_t upper_bound,
I32Array *sort_cache);

- public u32_t
+ public i32_t
Next(RangeScorer *self);

- public u32_t
- Skip_To(RangeScorer *self, u32_t target);
+ public i32_t
+ Skip_To(RangeScorer *self, i32_t target);

public Tally*
Tally(RangeScorer* self);

- public u32_t
+ public i32_t
Get_Doc_Num(RangeScorer* self);

void

Modified: trunk/c_src/KinoSearch/Search/RangeScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/RangeScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/RangeScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -40,7 +40,7 @@
Scorer_destroy((Scorer*)self);
}

-u32_t
+i32_t
RangeScorer_next(RangeScorer* self)
{
while(1) {
@@ -64,8 +64,8 @@
return self->doc_num;
}

-u32_t
-RangeScorer_skip_to(RangeScorer* self, u32_t target)
+i32_t
+RangeScorer_skip_to(RangeScorer* self, i32_t target)
{
self->doc_num = target - 1;
return RangeScorer_next(self);
@@ -77,7 +77,7 @@
return self->tally;
}

-u32_t
+i32_t
RangeScorer_get_doc_num(RangeScorer* self)
{
return self->doc_num;

Modified: trunk/c_src/KinoSearch/Search/RemoteFieldDoc.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/RemoteFieldDoc.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/RemoteFieldDoc.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -11,10 +11,10 @@
VArray *field_vals;

static incremented RemoteFieldDoc*
- new(u32_t doc_num, float score, VArray *field_vals);
+ new(i32_t doc_num, float score, VArray *field_vals);

static RemoteFieldDoc*
- init(RemoteFieldDoc *self, u32_t doc_num, float score, VArray *field_vals);
+ init(RemoteFieldDoc *self, i32_t doc_num, float score, VArray *field_vals);

public void
Serialize(RemoteFieldDoc *self, OutStream *outstream);

Modified: trunk/c_src/KinoSearch/Search/RemoteFieldDoc.c
===================================================================
--- trunk/c_src/KinoSearch/Search/RemoteFieldDoc.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/RemoteFieldDoc.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -5,14 +5,14 @@
#include "KinoSearch/Store/OutStream.h"

RemoteFieldDoc*
-RemoteFieldDoc_new(u32_t doc_num, float score, VArray *field_vals)
+RemoteFieldDoc_new(i32_t doc_num, float score, VArray *field_vals)
{
RemoteFieldDoc *self = (RemoteFieldDoc*)CREATE(NULL, REMOTEFIELDDOC);
return RemoteFieldDoc_init(self, doc_num, score, field_vals);
}

RemoteFieldDoc*
-RemoteFieldDoc_init(RemoteFieldDoc *self, u32_t doc_num, float score,
+RemoteFieldDoc_init(RemoteFieldDoc *self, i32_t doc_num, float score,
VArray *field_vals)
{
/* Assign. */

Modified: trunk/c_src/KinoSearch/Search/RequiredOptionalScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/RequiredOptionalScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/RequiredOptionalScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -22,16 +22,16 @@
void
Destroy(RequiredOptionalScorer *self);

- public u32_t
+ public i32_t
Next(RequiredOptionalScorer *self);

- public u32_t
- Skip_To(RequiredOptionalScorer *self, u32_t target);
+ public i32_t
+ Skip_To(RequiredOptionalScorer *self, i32_t target);

public Tally*
Tally(RequiredOptionalScorer *self);

- public u32_t
+ public i32_t
Get_Doc_Num(RequiredOptionalScorer *self);

u32_t

Modified: trunk/c_src/KinoSearch/Search/RequiredOptionalScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/RequiredOptionalScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/RequiredOptionalScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -40,19 +40,19 @@
Scorer_destroy((Scorer*)self);
}

-u32_t
+i32_t
ReqOptScorer_next(RequiredOptionalScorer *self)
{
return Scorer_Next(self->req_scorer);
}

-u32_t
-ReqOptScorer_skip_to(RequiredOptionalScorer *self, u32_t target)
+i32_t
+ReqOptScorer_skip_to(RequiredOptionalScorer *self, i32_t target)
{
return Scorer_Skip_To(self->req_scorer, target);
}

-u32_t
+i32_t
ReqOptScorer_get_doc_num(RequiredOptionalScorer *self)
{
return Scorer_Get_Doc_Num(self->req_scorer);
@@ -61,7 +61,7 @@
Tally*
ReqOptScorer_tally(RequiredOptionalScorer *self)
{
- u32_t const current_doc = Scorer_Get_Doc_Num(self->req_scorer);
+ i32_t const current_doc = Scorer_Get_Doc_Num(self->req_scorer);

if (self->opt_scorer_first_time) {
self->opt_scorer_first_time = false;
@@ -75,7 +75,7 @@
return Scorer_Tally(self->req_scorer);
}
else {
- u32_t opt_scorer_doc = Scorer_Get_Doc_Num(self->opt_scorer);
+ i32_t opt_scorer_doc = Scorer_Get_Doc_Num(self->opt_scorer);

if (opt_scorer_doc < current_doc) {
opt_scorer_doc = Scorer_Skip_To(self->opt_scorer, current_doc);

Modified: trunk/c_src/KinoSearch/Search/ScoreDoc.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/ScoreDoc.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/ScoreDoc.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -7,14 +7,14 @@

class KinoSearch::Search::ScoreDoc extends KinoSearch::Obj {

- u32_t doc_num;
+ i32_t doc_num;
float score;

static incremented ScoreDoc*
- new(u32_t doc_num, float score);
+ new(i32_t doc_num, float score);

static ScoreDoc*
- init(ScoreDoc *self, u32_t doc_num, float score);
+ init(ScoreDoc *self, i32_t doc_num, float score);

public void
Serialize(ScoreDoc *self, OutStream *outstream);
@@ -22,11 +22,11 @@
public incremented ScoreDoc*
Deserialize(ScoreDoc *self, InStream *instream);

- u32_t
+ i32_t
Get_Doc_Num(ScoreDoc *self);

void
- Set_Doc_Num(ScoreDoc *self, u32_t doc_num);
+ Set_Doc_Num(ScoreDoc *self, i32_t doc_num);

float
Get_Score(ScoreDoc *self);

Modified: trunk/c_src/KinoSearch/Search/ScoreDoc.c
===================================================================
--- trunk/c_src/KinoSearch/Search/ScoreDoc.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/ScoreDoc.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -5,14 +5,14 @@
#include "KinoSearch/Store/OutStream.h"

ScoreDoc*
-ScoreDoc_new(u32_t doc_num, float score)
+ScoreDoc_new(i32_t doc_num, float score)
{
ScoreDoc *self = (ScoreDoc*)CREATE(NULL, SCOREDOC);
return ScoreDoc_init(self, doc_num, score);
}

ScoreDoc*
-ScoreDoc_init(ScoreDoc *self, u32_t doc_num, float score)
+ScoreDoc_init(ScoreDoc *self, i32_t doc_num, float score)
{
self->doc_num = doc_num;
self->score = score;
@@ -35,12 +35,12 @@
return self;
}

-u32_t
+i32_t
ScoreDoc_get_doc_num(ScoreDoc *self) { return self->doc_num; }
float
ScoreDoc_get_score(ScoreDoc *self) { return self->score; }
void
-ScoreDoc_set_doc_num(ScoreDoc *self, u32_t doc_num)
+ScoreDoc_set_doc_num(ScoreDoc *self, i32_t doc_num)
{ self->doc_num = doc_num; }
void
ScoreDoc_set_score(ScoreDoc *self, float score)

Modified: trunk/c_src/KinoSearch/Search/Scorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/Scorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/Scorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -25,14 +25,14 @@
* @return either a positive document number, or 0 (an invalid document
* number) when there are no more documents which match.
*/
- public abstract u32_t
+ public abstract i32_t
Next(Scorer *self);

/** Return the scorer's current document number. Valid only after a
* successful call to Next() or Skip_To() and must not be called
* otherwise.
*/
- public abstract u32_t
+ public abstract i32_t
Get_Doc_Num(Scorer *self);

/** Return a Tally containing scoring information. Valid only after a
@@ -45,12 +45,12 @@
/** Skip to the first document number equal to or greater than the target.
* The default implementation just calls Scorer_Next() over and over.
*
- * @param target A non-zero document number.
+ * @param target A positive document number.
* @return either a positive document number, or 0 (an invalid document
* number) when there are no more documents which match.
*/
- public u32_t
- Skip_To(Scorer *self, u32_t target);
+ public i32_t
+ Skip_To(Scorer *self, i32_t target);

/** Collect hits bracketed by <code>start</code>, inclusive, and
* <code>limit</code>, exclusive. Collect a maximum of
@@ -64,8 +64,8 @@
* @param seg_starts The first document number for each segment.
*/
void
- Collect(Scorer *self, HitCollector *collector, u32_t start = 1,
- u32_t limit = 0x7FFFFFFF, u32_t hits_per_seg = 0x7FFFFFFF,
+ Collect(Scorer *self, HitCollector *collector, i32_t start = 1,
+ i32_t limit = 0x7FFFFFFF, u32_t hits_per_seg = 0x7FFFFFFF,
I32Array *seg_starts = NULL);

/** Return the maximum number of subscorers that can match. Used by

Modified: trunk/c_src/KinoSearch/Search/Scorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/Scorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/Scorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -22,26 +22,26 @@
FREE_OBJ(self);
}

-u32_t
-Scorer_skip_to(Scorer *self, u32_t target)
+i32_t
+Scorer_skip_to(Scorer *self, i32_t target)
{
while (1) {
- u32_t doc_num = Scorer_Next(self);
+ i32_t doc_num = Scorer_Next(self);
if (doc_num == 0 || doc_num >= target)
return doc_num;
}
}

void
-Scorer_collect(Scorer *self, HitCollector *hit_collector, u32_t start,
- u32_t limit, u32_t hits_per_seg, I32Array *seg_starts)
+Scorer_collect(Scorer *self, HitCollector *hit_collector, i32_t start,
+ i32_t limit, u32_t hits_per_seg, I32Array *seg_starts)
{
u32_t seg_num = 0;
- u32_t doc_num_thresh = 0;
+ i32_t doc_num_thresh = 0;
u32_t hits_this_seg = 0;
u32_t hits_thresh = hits_per_seg;
u32_t num_seg_starts = seg_starts ? I32Arr_Get_Size(seg_starts) : 0;
- u32_t doc_num;
+ i32_t doc_num;

if (start == 0)
CONFESS("start must be greater than 0.");
@@ -78,7 +78,7 @@
seg_num++;

/* Skip docs as appropriate if we're pruning. */
- if (doc_num < (u32_t)this_start) {
+ if (doc_num < this_start) {
doc_num = Scorer_Skip_To(self, this_start);
if (!doc_num)
return;
@@ -87,7 +87,7 @@
/* Set the last doc_num we'll score this upcoming segment. */
doc_num_thresh = next_start == -1
? limit /* last segment */
- : (u32_t)next_start;
+ : next_start;
}

/* Start over counting hits for the new segment. */

Modified: trunk/c_src/KinoSearch/Search/ScorerDocQueue.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/ScorerDocQueue.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/ScorerDocQueue.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -7,7 +7,7 @@
*/
typedef struct kino_HeapedScorerDoc {
kino_Scorer *scorer;
- chy_u32_t doc;
+ chy_i32_t doc;
} kino_HeapedScorerDoc;

/* Get the Scorer at the top of the queue -- with the least document number.
@@ -75,14 +75,14 @@
/* Call Scorer_Next() on the top score and adjust the queue, removing the
* Scorer if Scorer_Next() returns false.
*/
- u32_t
+ i32_t
Top_Next(ScorerDocQueue *self);

/* Call Scorer_Skip_To() on the top scorer and adjust the queue, removing the
* Scorer if Scorer_Skip_To() returns false.
*/
- u32_t
- Top_Skip_To(ScorerDocQueue *self, u32_t target);
+ i32_t
+ Top_Skip_To(ScorerDocQueue *self, i32_t target);

/* Pop the scorer with the lowest doc off the top of the queue.
*/

Modified: trunk/c_src/KinoSearch/Search/ScorerDocQueue.c
===================================================================
--- trunk/c_src/KinoSearch/Search/ScorerDocQueue.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/ScorerDocQueue.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -6,7 +6,7 @@
static INLINE void
clear(ScorerDocQueue *self);

-static INLINE u32_t
+static INLINE i32_t
check_adjust_else_pop(ScorerDocQueue *self);

static INLINE void
@@ -108,7 +108,7 @@
/* Otherwise, compete for the slot. */
else {
HeapedScorerDoc *const top_hsd = self->top_hsd;
- const u32_t doc_num = Scorer_Get_Doc_Num(scorer);
+ const i32_t doc_num = Scorer_Get_Doc_Num(scorer);
if ( self->size > 0
&& !(doc_num < top_hsd->doc)
) {
@@ -125,7 +125,7 @@
}
}

-static INLINE u32_t
+static INLINE i32_t
check_adjust_else_pop(ScorerDocQueue *self)
{
HeapedScorerDoc *const top_hsd = self->top_hsd;
@@ -154,7 +154,7 @@
return self->top_hsd->doc;
}

-u32_t
+i32_t
ScorerDocQ_top_next(ScorerDocQueue *self)
{
HeapedScorerDoc *const top_hsd = self->top_hsd;
@@ -162,8 +162,8 @@
return check_adjust_else_pop(self);
}

-u32_t
-ScorerDocQ_top_skip_to(ScorerDocQueue *self, u32_t target)
+i32_t
+ScorerDocQ_top_skip_to(ScorerDocQueue *self, i32_t target)
{
HeapedScorerDoc *const top_hsd = self->top_hsd;
top_hsd->doc = Scorer_Skip_To(top_hsd->scorer, target);

Modified: trunk/c_src/KinoSearch/Search/Searchable.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/Searchable.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/Searchable.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -25,7 +25,7 @@
* the Searchable, which is also the largest possible doc number. Deleted
* docs are included in this count.
*/
- public abstract u32_t
+ public abstract i32_t
Max_Docs(Searchable *self);

/** Return the number of documents which contain the term in the given
@@ -79,13 +79,13 @@
* object. Throws an error if the doc num is out of range.
*/
public abstract incremented HitDoc*
- Fetch_Doc(Searchable *self, u32_t doc_num);
+ Fetch_Doc(Searchable *self, i32_t doc_num);

/** Return the DocVector identified by the supplied doc num. Throws an
* error if the doc num is out of range.
*/
abstract incremented DocVector*
- Fetch_Doc_Vec(Searchable *self, u32_t doc_num);
+ Fetch_Doc_Vec(Searchable *self, i32_t doc_num);

/** Accessor for the object's <code>schema</code> member.
*/

Modified: trunk/c_src/KinoSearch/Search/TermScorer.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/TermScorer.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/TermScorer.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -21,13 +21,13 @@
void
Destroy(TermScorer *self);

- public u32_t
+ public i32_t
Next(TermScorer* self);

- public u32_t
- Skip_To(TermScorer* self, u32_t target);
+ public i32_t
+ Skip_To(TermScorer* self, i32_t target);

- public u32_t
+ public i32_t
Get_Doc_Num(TermScorer* self);

public Tally*

Modified: trunk/c_src/KinoSearch/Search/TermScorer.c
===================================================================
--- trunk/c_src/KinoSearch/Search/TermScorer.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Search/TermScorer.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -34,12 +34,12 @@
Scorer_destroy((Scorer*)self);
}

-u32_t
+i32_t
TermScorer_next(TermScorer* self)
{
PostingList *const plist = self->plist;
if (plist) {
- u32_t doc_num = PList_Next(plist);
+ i32_t doc_num = PList_Next(plist);
if (doc_num) {
self->posting = PList_Get_Posting(plist);
return doc_num;
@@ -54,12 +54,12 @@
return 0;
}

-u32_t
-TermScorer_skip_to(TermScorer *self, u32_t target)
+i32_t
+TermScorer_skip_to(TermScorer *self, i32_t target)
{
PostingList *const plist = self->plist;
if (plist) {
- u32_t doc_num = PList_Skip_To(plist, target);
+ i32_t doc_num = PList_Skip_To(plist, target);
if (doc_num) {
self->posting = PList_Get_Posting(plist);
return doc_num;
@@ -74,7 +74,7 @@
return 0;
}

-u32_t
+i32_t
TermScorer_get_doc_num(TermScorer* self)
{
return self->posting->doc_num;

Modified: trunk/c_src/KinoSearch/Searcher.bp
===================================================================
--- trunk/c_src/KinoSearch/Searcher.bp 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Searcher.bp 2008-08-25 20:16:50 UTC (rev 3762)
@@ -27,7 +27,7 @@
void
Destroy(Searcher *self);

- public u32_t
+ public i32_t
Max_Docs(Searcher *self);

public u32_t
@@ -41,10 +41,10 @@
SortSpec *sort_spec = NULL);

public incremented HitDoc*
- Fetch_Doc(Searcher *self, u32_t doc_num);
+ Fetch_Doc(Searcher *self, i32_t doc_num);

incremented DocVector*
- Fetch_Doc_Vec(Searcher *self, u32_t doc_num);
+ Fetch_Doc_Vec(Searcher *self, i32_t doc_num);

/** Accessor for the object's <code>reader</code> member.
*/

Modified: trunk/c_src/KinoSearch/Searcher.c
===================================================================
--- trunk/c_src/KinoSearch/Searcher.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/c_src/KinoSearch/Searcher.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -48,18 +48,18 @@
}

HitDoc*
-Searcher_fetch_doc(Searcher *self, u32_t doc_num)
+Searcher_fetch_doc(Searcher *self, i32_t doc_num)
{
return IxReader_Fetch_Doc(self->reader, doc_num);
}

DocVector*
-Searcher_fetch_doc_vec(Searcher *self, u32_t doc_num)
+Searcher_fetch_doc_vec(Searcher *self, i32_t doc_num)
{
return IxReader_Fetch_Doc_Vec(self->reader, doc_num);
}

-u32_t
+i32_t
Searcher_max_docs(Searcher *self)
{
return IxReader_Max_Docs(self->reader);

Modified: trunk/perl/xs/KinoSearch/Doc.c
===================================================================
--- trunk/perl/xs/KinoSearch/Doc.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/perl/xs/KinoSearch/Doc.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -5,7 +5,7 @@
#include "KinoSearch/Util/Native.h"

kino_Doc*
-kino_Doc_init(kino_Doc *self, void *fields, chy_u32_t doc_num, float boost)
+kino_Doc_init(kino_Doc *self, void *fields, chy_i32_t doc_num, float boost)
{
/* Assign. */
if (fields) {
@@ -40,7 +40,7 @@
kino_Doc*
kino_Doc_deserialize(kino_Doc *self, kino_InStream *instream)
{
- chy_u32_t doc_num = Kino_InStream_Read_C32(instream);
+ chy_i32_t doc_num = (chy_i32_t)Kino_InStream_Read_C32(instream);
float boost = Kino_InStream_Read_Float(instream);

self = self ? self : (kino_Doc*)KINO_CREATE(NULL, KINO_DOC);

Modified: trunk/perl/xs/KinoSearch/Index/DocReader.c
===================================================================
--- trunk/perl/xs/KinoSearch/Index/DocReader.c 2008-08-25 16:16:33 UTC (rev 3761)
+++ trunk/perl/xs/KinoSearch/Index/DocReader.c 2008-08-25 20:16:50 UTC (rev 3762)
@@ -9,7 +9,7 @@
#include "KinoSearch/Util/Native.h"

kino_HitDoc*
-kino_DocReader_fetch_doc(kino_DocReader *self, chy_u32_t doc_num)
+kino_DocReader_fetch_doc(kino_DocReader *self, chy_i32_t doc_num)
{
kino_Schema *const schema = self->invindex->schema;
kino_InStream *const ds_in = self->ds_in;


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