Repository: lucy
Updated Branches:
  refs/heads/master e914c3cee -> 3f9b4a7fa


Cast some freq values.

Perform some harmless sign casts for integers containing frequency
counts (term freq, doc freq).


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/48a4d185
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/48a4d185
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/48a4d185

Branch: refs/heads/master
Commit: 48a4d185fc3570c7336dae884f8343377e31608e
Parents: e914c3c
Author: Marvin Humphrey <mar...@rectangular.com>
Authored: Thu May 26 18:09:40 2016 -0700
Committer: Marvin Humphrey <mar...@rectangular.com>
Committed: Thu May 26 18:09:40 2016 -0700

----------------------------------------------------------------------
 core/Lucy/Index/LexiconReader.c        | 2 +-
 core/Lucy/Index/Posting/MatchPosting.c | 2 +-
 core/Lucy/Index/PostingPool.c          | 2 +-
 core/Lucy/Search/PhraseQuery.c         | 4 ++--
 core/Lucy/Search/TermQuery.c           | 8 ++++----
 core/LucyX/Search/ProximityQuery.c     | 4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/48a4d185/core/Lucy/Index/LexiconReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexiconReader.c b/core/Lucy/Index/LexiconReader.c
index 60949aa..cc8b8b7 100644
--- a/core/Lucy/Index/LexiconReader.c
+++ b/core/Lucy/Index/LexiconReader.c
@@ -243,7 +243,7 @@ uint32_t
 DefLexReader_Doc_Freq_IMP(DefaultLexiconReader *self, String *field,
                           Obj *term) {
     TermInfo *tinfo = S_find_tinfo(self, field, term);
-    return tinfo ? TInfo_Get_Doc_Freq(tinfo) : 0;
+    return tinfo ? (uint32_t)TInfo_Get_Doc_Freq(tinfo) : 0;
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/48a4d185/core/Lucy/Index/Posting/MatchPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/MatchPosting.c 
b/core/Lucy/Index/Posting/MatchPosting.c
index 7197de9..77931c1 100644
--- a/core/Lucy/Index/Posting/MatchPosting.c
+++ b/core/Lucy/Index/Posting/MatchPosting.c
@@ -70,7 +70,7 @@ MatchPost_Destroy_IMP(MatchPosting *self) {
 
 int32_t
 MatchPost_Get_Freq_IMP(MatchPosting *self) {
-    return MatchPost_IVARS(self)->freq;
+    return (int32_t)MatchPost_IVARS(self)->freq;
 }
 
 void

http://git-wip-us.apache.org/repos/asf/lucy/blob/48a4d185/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index 0e76d4e..0ca97ac 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -483,7 +483,7 @@ PostPool_Refill_IMP(PostingPool *self) {
         if (ivars->post_count == 0) {
             // Read a term.
             if (Lex_Next(lexicon)) {
-                ivars->post_count = Lex_Doc_Freq(lexicon);
+                ivars->post_count = (uint32_t)Lex_Doc_Freq(lexicon);
                 term_text = (String*)Lex_Get_Term(lexicon);
                 if (term_text && !Obj_is_a((Obj*)term_text, STRING)) {
                     THROW(ERR, "Only String terms are supported for now");

http://git-wip-us.apache.org/repos/asf/lucy/blob/48a4d185/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index 9d2f277..8cc2907 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -221,8 +221,8 @@ PhraseCompiler_init(PhraseCompiler *self, PhraseQuery 
*parent,
     for (size_t i = 0, max = Vec_Get_Size(terms); i < max; i++) {
         Obj     *term     = Vec_Fetch(terms, i);
         int32_t  doc_max  = Searcher_Doc_Max(searcher);
-        int32_t  doc_freq = Searcher_Doc_Freq(searcher, parent_ivars->field, 
term);
-        ivars->idf += Sim_IDF(sim, doc_freq, doc_max);
+        uint32_t doc_freq = Searcher_Doc_Freq(searcher, parent_ivars->field, 
term);
+        ivars->idf += Sim_IDF(sim, (int32_t)doc_freq, doc_max);
     }
 
     // Calculate raw weight.

http://git-wip-us.apache.org/repos/asf/lucy/blob/48a4d185/core/Lucy/Search/TermQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.c b/core/Lucy/Search/TermQuery.c
index 397f865..c15a576 100644
--- a/core/Lucy/Search/TermQuery.c
+++ b/core/Lucy/Search/TermQuery.c
@@ -166,10 +166,10 @@ TermCompiler_init(TermCompiler *self, Query *parent, 
Searcher *searcher,
     ivars->query_norm_factor = 0.0f;
 
     // Derive.
-    int32_t doc_max  = Searcher_Doc_Max(searcher);
-    int32_t doc_freq = Searcher_Doc_Freq(searcher, parent_ivars->field,
-                                         parent_ivars->term);
-    ivars->idf = Sim_IDF(sim, doc_freq, doc_max);
+    int32_t  doc_max  = Searcher_Doc_Max(searcher);
+    uint32_t doc_freq = Searcher_Doc_Freq(searcher, parent_ivars->field,
+                                          parent_ivars->term);
+    ivars->idf = Sim_IDF(sim, (int32_t)doc_freq, doc_max);
 
     /* The score of any document is approximately equal to:
      *

http://git-wip-us.apache.org/repos/asf/lucy/blob/48a4d185/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c 
b/core/LucyX/Search/ProximityQuery.c
index 1a93584..170bdda 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -242,9 +242,9 @@ ProximityCompiler_init(ProximityCompiler *self, 
ProximityQuery *parent,
     for (size_t i = 0, max = Vec_Get_Size(terms); i < max; i++) {
         Obj *term = Vec_Fetch(terms, i);
         int32_t doc_max  = Searcher_Doc_Max(searcher);
-        int32_t doc_freq
+        uint32_t doc_freq
             = Searcher_Doc_Freq(searcher, parent_ivars->field,term);
-        ivars->idf += Sim_IDF(sim, doc_freq, doc_max);
+        ivars->idf += Sim_IDF(sim, (int32_t)doc_freq, doc_max);
     }
 
     // Calculate raw weight.

Reply via email to