Switch C32 code relating to doc IDs. Doc IDs are signed. Delta doc IDs may signed or unsigned. Use the appropriate CI32 or CU32 read/write methods for both.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/3089bfdf Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/3089bfdf Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/3089bfdf Branch: refs/heads/master Commit: 3089bfdf4c09b7cf3f937405417c93e23063d727 Parents: e5ba8a1 Author: Marvin Humphrey <[email protected]> Authored: Wed Apr 20 18:40:26 2016 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Wed Apr 20 19:26:48 2016 -0700 ---------------------------------------------------------------------- c/src/Lucy/Document/Doc.c | 4 ++-- core/Lucy/Index/Posting/MatchPosting.c | 4 ++-- core/Lucy/Index/Posting/RawPosting.c | 4 ++-- core/Lucy/Index/SkipStepper.c | 4 ++-- core/Lucy/Search/MatchDoc.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/3089bfdf/c/src/Lucy/Document/Doc.c ---------------------------------------------------------------------- diff --git a/c/src/Lucy/Document/Doc.c b/c/src/Lucy/Document/Doc.c index d0fb065..19b9d9d 100644 --- a/c/src/Lucy/Document/Doc.c +++ b/c/src/Lucy/Document/Doc.c @@ -69,14 +69,14 @@ Doc_Serialize_IMP(Doc *self, OutStream *outstream) { DocIVARS *const ivars = Doc_IVARS(self); Hash *hash = (Hash*)ivars->fields; Freezer_serialize_hash(hash, outstream); - OutStream_Write_C32(outstream, ivars->doc_id); + OutStream_Write_CI32(outstream, ivars->doc_id); } Doc* Doc_Deserialize_IMP(Doc *self, InStream *instream) { DocIVARS *const ivars = Doc_IVARS(self); ivars->fields = Freezer_read_hash(instream); - ivars->doc_id = InStream_Read_C32(instream); + ivars->doc_id = InStream_Read_CI32(instream); return self; } http://git-wip-us.apache.org/repos/asf/lucy/blob/3089bfdf/core/Lucy/Index/Posting/MatchPosting.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Posting/MatchPosting.c b/core/Lucy/Index/Posting/MatchPosting.c index c7348fa..2bda909 100644 --- a/core/Lucy/Index/Posting/MatchPosting.c +++ b/core/Lucy/Index/Posting/MatchPosting.c @@ -212,11 +212,11 @@ MatchPostWriter_Write_Posting_IMP(MatchPostingWriter *self, RawPosting *posting) + posting_ivars->content_len; if (posting_ivars->freq == 1) { const uint32_t doc_code = (delta_doc << 1) | 1; - OutStream_Write_C32(outstream, doc_code); + OutStream_Write_CU32(outstream, doc_code); } else { const uint32_t doc_code = delta_doc << 1; - OutStream_Write_C32(outstream, doc_code); + OutStream_Write_CU32(outstream, doc_code); OutStream_Write_C32(outstream, posting_ivars->freq); } OutStream_Write_Bytes(outstream, aux_content, posting_ivars->aux_len); http://git-wip-us.apache.org/repos/asf/lucy/blob/3089bfdf/core/Lucy/Index/Posting/RawPosting.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Posting/RawPosting.c b/core/Lucy/Index/Posting/RawPosting.c index 06e5367..052020a 100644 --- a/core/Lucy/Index/Posting/RawPosting.c +++ b/core/Lucy/Index/Posting/RawPosting.c @@ -133,11 +133,11 @@ RawPostWriter_Write_Posting_IMP(RawPostingWriter *self, RawPosting *posting) { + posting_ivars->content_len; if (posting_ivars->freq == 1) { const uint32_t doc_code = (delta_doc << 1) | 1; - OutStream_Write_C32(outstream, doc_code); + OutStream_Write_CU32(outstream, doc_code); } else { const uint32_t doc_code = delta_doc << 1; - OutStream_Write_C32(outstream, doc_code); + OutStream_Write_CU32(outstream, doc_code); OutStream_Write_C32(outstream, posting_ivars->freq); } OutStream_Write_Bytes(outstream, aux_content, posting_ivars->aux_len); http://git-wip-us.apache.org/repos/asf/lucy/blob/3089bfdf/core/Lucy/Index/SkipStepper.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SkipStepper.c b/core/Lucy/Index/SkipStepper.c index 634e2d8..2fe5b3c 100644 --- a/core/Lucy/Index/SkipStepper.c +++ b/core/Lucy/Index/SkipStepper.c @@ -47,7 +47,7 @@ SkipStepper_Set_ID_And_Filepos_IMP(SkipStepper *self, int32_t doc_id, void SkipStepper_Read_Record_IMP(SkipStepper *self, InStream *instream) { SkipStepperIVARS *const ivars = SkipStepper_IVARS(self); - ivars->doc_id += InStream_Read_C32(instream); + ivars->doc_id += InStream_Read_CI32(instream); ivars->filepos += InStream_Read_CI64(instream); } @@ -66,7 +66,7 @@ SkipStepper_Write_Record_IMP(SkipStepper *self, OutStream *outstream, const int64_t delta_filepos = ivars->filepos - last_filepos; // Write delta doc id. - OutStream_Write_C32(outstream, delta_doc_id); + OutStream_Write_CI32(outstream, delta_doc_id); // Write delta file pointer. OutStream_Write_CI64(outstream, delta_filepos); http://git-wip-us.apache.org/repos/asf/lucy/blob/3089bfdf/core/Lucy/Search/MatchDoc.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/MatchDoc.c b/core/Lucy/Search/MatchDoc.c index bbc4b59..1ac57ed 100644 --- a/core/Lucy/Search/MatchDoc.c +++ b/core/Lucy/Search/MatchDoc.c @@ -47,7 +47,7 @@ MatchDoc_Destroy_IMP(MatchDoc *self) { void MatchDoc_Serialize_IMP(MatchDoc *self, OutStream *outstream) { MatchDocIVARS *const ivars = MatchDoc_IVARS(self); - OutStream_Write_C32(outstream, ivars->doc_id); + OutStream_Write_CI32(outstream, ivars->doc_id); OutStream_Write_F32(outstream, ivars->score); OutStream_Write_U8(outstream, ivars->values ? 1 : 0); if (ivars->values) { Freezer_serialize_varray(ivars->values, outstream); } @@ -56,7 +56,7 @@ MatchDoc_Serialize_IMP(MatchDoc *self, OutStream *outstream) { MatchDoc* MatchDoc_Deserialize_IMP(MatchDoc *self, InStream *instream) { MatchDocIVARS *const ivars = MatchDoc_IVARS(self); - ivars->doc_id = InStream_Read_C32(instream); + ivars->doc_id = InStream_Read_CI32(instream); ivars->score = InStream_Read_F32(instream); if (InStream_Read_U8(instream)) { ivars->values = Freezer_read_varray(instream);
