Adapt PhraseQuery, ProximityQuery for I32Array. Adapt these two very similar Query subclasses for the I32Array size change.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ffb3c830 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ffb3c830 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ffb3c830 Branch: refs/heads/master Commit: ffb3c830ac57fd5d94b24b1ad438542238b8ac84 Parents: bb4f6e4 Author: Marvin Humphrey <[email protected]> Authored: Tue Apr 5 19:05:43 2016 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Wed Apr 6 13:03:09 2016 -0700 ---------------------------------------------------------------------- core/Lucy/Search/PhraseQuery.c | 20 ++++++++++---------- core/LucyX/Search/ProximityQuery.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/ffb3c830/core/Lucy/Search/PhraseQuery.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c index a74547d..48d7c13 100644 --- a/core/Lucy/Search/PhraseQuery.c +++ b/core/Lucy/Search/PhraseQuery.c @@ -375,8 +375,8 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher, if (i == 0) { // Set initial positions from first term. I32Array *positions = TV_Get_Positions(term_vector); - for (uint32_t j = I32Arr_Get_Size(positions); j > 0; j--) { - BitVec_Set(posit_vec, I32Arr_Get(positions, j - 1)); + for (size_t j = I32Arr_Get_Size(positions); j > 0; j--) { + BitVec_Set(posit_vec, (uint32_t)I32Arr_Get(positions, j - 1)); } } else { @@ -384,8 +384,8 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher, I32Array *positions = TV_Get_Positions(term_vector); BitVec_Clear_All(other_posit_vec); - for (uint32_t j = I32Arr_Get_Size(positions); j > 0; j--) { - int32_t pos = I32Arr_Get(positions, j - 1) - i; + for (size_t j = I32Arr_Get_Size(positions); j > 0; j--) { + int32_t pos = I32Arr_Get(positions, j - 1) - (int32_t)i; if (pos >= 0) { BitVec_Set(other_posit_vec, pos); } @@ -406,24 +406,24 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher, I32Array *tv_end_offsets = TV_Get_End_Offsets(last_tv); uint32_t terms_max = num_terms - 1; I32Array *valid_posits = BitVec_To_Array(posit_vec); - uint32_t num_valid_posits = I32Arr_Get_Size(valid_posits); - uint32_t j = 0; + size_t num_valid_posits = I32Arr_Get_Size(valid_posits); + size_t j = 0; float weight = PhraseCompiler_Get_Weight(self); - uint32_t i = 0; + size_t i = 0; // Add only those starts/ends that belong to a valid position. - for (uint32_t posit_tick = 0; posit_tick < num_valid_posits; posit_tick++) { + for (size_t posit_tick = 0; posit_tick < num_valid_posits; posit_tick++) { int32_t valid_start_posit = I32Arr_Get(valid_posits, posit_tick); int32_t valid_end_posit = valid_start_posit + terms_max; int32_t start_offset = 0, end_offset = 0; - for (uint32_t max = I32Arr_Get_Size(tv_start_positions); i < max; i++) { + for (size_t max = I32Arr_Get_Size(tv_start_positions); i < max; i++) { if (I32Arr_Get(tv_start_positions, i) == valid_start_posit) { start_offset = I32Arr_Get(tv_start_offsets, i); break; } } - for (uint32_t max = I32Arr_Get_Size(tv_end_positions); j < max; j++) { + for (size_t max = I32Arr_Get_Size(tv_end_positions); j < max; j++) { if (I32Arr_Get(tv_end_positions, j) == valid_end_posit) { end_offset = I32Arr_Get(tv_end_offsets, j); break; http://git-wip-us.apache.org/repos/asf/lucy/blob/ffb3c830/core/LucyX/Search/ProximityQuery.c ---------------------------------------------------------------------- diff --git a/core/LucyX/Search/ProximityQuery.c b/core/LucyX/Search/ProximityQuery.c index a4d42cc..2f31933 100644 --- a/core/LucyX/Search/ProximityQuery.c +++ b/core/LucyX/Search/ProximityQuery.c @@ -404,8 +404,8 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler *self, if (i == 0) { // Set initial positions from first term. I32Array *positions = TV_Get_Positions(term_vector); - for (uint32_t j = I32Arr_Get_Size(positions); j > 0; j--) { - BitVec_Set(posit_vec, I32Arr_Get(positions, j - 1)); + for (size_t j = I32Arr_Get_Size(positions); j > 0; j--) { + BitVec_Set(posit_vec, (uint32_t)I32Arr_Get(positions, j - 1)); } } else { @@ -413,8 +413,8 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler *self, I32Array *positions = TV_Get_Positions(term_vector); BitVec_Clear_All(other_posit_vec); - for (uint32_t j = I32Arr_Get_Size(positions); j > 0; j--) { - int32_t pos = I32Arr_Get(positions, j - 1) - i; + for (size_t j = I32Arr_Get_Size(positions); j > 0; j--) { + int32_t pos = I32Arr_Get(positions, j - 1) - (int32_t)i; if (pos >= 0) { BitVec_Set(other_posit_vec, pos); } @@ -435,24 +435,24 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler *self, I32Array *tv_end_offsets = TV_Get_End_Offsets(last_tv); uint32_t terms_max = num_terms - 1; I32Array *valid_posits = BitVec_To_Array(posit_vec); - uint32_t num_valid_posits = I32Arr_Get_Size(valid_posits); - uint32_t j = 0; + size_t num_valid_posits = I32Arr_Get_Size(valid_posits); + size_t j = 0; float weight = ProximityCompiler_Get_Weight(self); - uint32_t i = 0; + size_t i = 0; // Add only those starts/ends that belong to a valid position. - for (uint32_t posit_tick = 0; posit_tick < num_valid_posits; posit_tick++) { + for (size_t posit_tick = 0; posit_tick < num_valid_posits; posit_tick++) { int32_t valid_start_posit = I32Arr_Get(valid_posits, posit_tick); int32_t valid_end_posit = valid_start_posit + terms_max; int32_t start_offset = 0, end_offset = 0; - for (uint32_t max = I32Arr_Get_Size(tv_start_positions); i < max; i++) { + for (size_t max = I32Arr_Get_Size(tv_start_positions); i < max; i++) { if (I32Arr_Get(tv_start_positions, i) == valid_start_posit) { start_offset = I32Arr_Get(tv_start_offsets, i); break; } } - for (uint32_t max = I32Arr_Get_Size(tv_end_positions); j < max; j++) { + for (size_t max = I32Arr_Get_Size(tv_end_positions); j < max; j++) { if (I32Arr_Get(tv_end_positions, j) == valid_end_posit) { end_offset = I32Arr_Get(tv_end_offsets, j); break;
