You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2013/07/12 00:33:27 UTC
[lucy-commits] [02/11] git commit: refs/heads/ivars-wip1 - Fixup Lucy Search classes
IVARS glitches.
Fixup Lucy Search classes IVARS glitches.
(Will be folded into earlier commit before merging to master.)
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/d12c4e2a
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/d12c4e2a
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/d12c4e2a
Branch: refs/heads/ivars-wip1
Commit: d12c4e2a6635b51f01f03073c487c24a2dc46421
Parents: 5c3f746
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 11 14:57:33 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Jul 11 14:57:33 2013 -0700
----------------------------------------------------------------------
core/Lucy/Search/HitQueue.c | 3 ++-
core/Lucy/Search/NoMatchQuery.c | 3 ++-
core/Lucy/Search/PhraseMatcher.c | 14 ++++++++------
core/Lucy/Search/PolyQuery.c | 5 +++--
4 files changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/d12c4e2a/core/Lucy/Search/HitQueue.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/HitQueue.c b/core/Lucy/Search/HitQueue.c
index a2a65bb..868fcae 100644
--- a/core/Lucy/Search/HitQueue.c
+++ b/core/Lucy/Search/HitQueue.c
@@ -125,7 +125,8 @@ HitQ_jostle(HitQueue *self, Obj *element) {
HitQ_Jostle_t super_jostle
= SUPER_METHOD_PTR(HITQUEUE, Lucy_HitQ_Jostle);
if (ivars->need_values) {
- CERTIFY(match_doc->values, VARRAY);
+ MatchDocIVARS *const match_doc_ivars = MatchDoc_IVARS(match_doc);
+ CERTIFY(match_doc_ivars->values, VARRAY);
}
return super_jostle(self, element);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/d12c4e2a/core/Lucy/Search/NoMatchQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NoMatchQuery.c b/core/Lucy/Search/NoMatchQuery.c
index 1b3afae..1950c16 100644
--- a/core/Lucy/Search/NoMatchQuery.c
+++ b/core/Lucy/Search/NoMatchQuery.c
@@ -95,7 +95,8 @@ NoMatchQuery_load(NoMatchQuery *self, Obj *dump) {
= SUPER_METHOD_PTR(NOMATCHQUERY, Lucy_NoMatchQuery_Load);
NoMatchQuery *loaded = super_load(self, dump);
Obj *fails = Cfish_Hash_Fetch_Str(source, "fails_to_match", 14);
- loaded->fails_to_match = fails ? Obj_To_Bool(fails) : true;
+ NoMatchQuery_IVARS(loaded)->fails_to_match
+ = fails ? Obj_To_Bool(fails) : true;
return loaded;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/d12c4e2a/core/Lucy/Search/PhraseMatcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseMatcher.c b/core/Lucy/Search/PhraseMatcher.c
index 7915479..0fb956d 100644
--- a/core/Lucy/Search/PhraseMatcher.c
+++ b/core/Lucy/Search/PhraseMatcher.c
@@ -268,21 +268,23 @@ PhraseMatcher_calc_phrase_freq(PhraseMatcher *self) {
* is our phrase freq.
*/
ScorePosting *posting = (ScorePosting*)PList_Get_Posting(plists[0]);
- uint32_t anchors_remaining = posting->freq;
+ ScorePostingIVARS *const post_ivars = ScorePost_IVARS(posting);
+ uint32_t anchors_remaining = post_ivars->freq;
if (!anchors_remaining) { return 0.0f; }
size_t amount = anchors_remaining * sizeof(uint32_t);
uint32_t *anchors_start = (uint32_t*)BB_Grow(ivars->anchor_set, amount);
uint32_t *anchors_end = anchors_start + anchors_remaining;
- memcpy(anchors_start, posting->prox, amount);
+ memcpy(anchors_start, post_ivars->prox, amount);
// Match the positions of other terms against the anchor set.
for (uint32_t i = 1, max = ivars->num_elements; i < max; i++) {
// Get the array of positions for the next term. Unlike the anchor
// set (which is a copy), these won't be overwritten.
- ScorePosting *posting = (ScorePosting*)PList_Get_Posting(plists[i]);
- uint32_t *candidates_start = posting->prox;
- uint32_t *candidates_end = candidates_start + posting->freq;
+ ScorePosting *next_post = (ScorePosting*)PList_Get_Posting(plists[i]);
+ ScorePostingIVARS *const next_post_ivars = ScorePost_IVARS(next_post);
+ uint32_t *candidates_start = next_post_ivars->prox;
+ uint32_t *candidates_end = candidates_start + next_post_ivars->freq;
// Splice out anchors that don't match the next term. Bail out if
// we've eliminated all possible anchors.
@@ -310,7 +312,7 @@ PhraseMatcher_score(PhraseMatcher *self) {
ScorePosting *posting = (ScorePosting*)PList_Get_Posting(ivars->plists[0]);
float score = Sim_TF(ivars->sim, ivars->phrase_freq)
* ivars->weight
- * posting->weight;
+ * ScorePost_IVARS(posting)->weight;
return score;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/d12c4e2a/core/Lucy/Search/PolyQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c
index 3e73b4c..da87dc1 100644
--- a/core/Lucy/Search/PolyQuery.c
+++ b/core/Lucy/Search/PolyQuery.c
@@ -110,14 +110,15 @@ PolyCompiler*
PolyCompiler_init(PolyCompiler *self, PolyQuery *parent,
Searcher *searcher, float boost) {
PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self);
- const uint32_t num_kids = VA_Get_Size(parent->children);
+ PolyQueryIVARS *const parent_ivars = PolyQuery_IVARS(parent);
+ const uint32_t num_kids = VA_Get_Size(parent_ivars->children);
Compiler_init((Compiler*)self, (Query*)parent, searcher, NULL, boost);
ivars->children = VA_new(num_kids);
// Iterate over the children, creating a Compiler for each one.
for (uint32_t i = 0; i < num_kids; i++) {
- Query *child_query = (Query*)VA_Fetch(parent->children, i);
+ Query *child_query = (Query*)VA_Fetch(parent_ivars->children, i);
float sub_boost = boost * Query_Get_Boost(child_query);
Compiler *child_compiler
= Query_Make_Compiler(child_query, searcher, sub_boost, true);