From: Adam Dickmeiss Date: Tue, 13 Oct 2009 13:55:46 +0000 (+0200) Subject: Deal with relevance values round-off case X-Git-Tag: v1.2.3~23 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=d2eeebeeae413abd5b189e38b5e81fa0516e0752;p=pazpar2-moved-to-github.git Deal with relevance values round-off case --- diff --git a/src/relevance.c b/src/relevance.c index f2a58e7..262d517 100644 --- a/src/relevance.c +++ b/src/relevance.c @@ -313,7 +313,7 @@ void relevance_prepare_read(struct relevance *rel, struct reclist *reclist) while (1) { int t; - float relevance = 0; + int relevance = 0; struct record_cluster *rec = reclist_read_record(reclist); if (!rec) break; @@ -323,9 +323,9 @@ void relevance_prepare_read(struct relevance *rel, struct reclist *reclist) if (!rec->term_frequency_vec[0]) break; termfreq = (float) rec->term_frequency_vec[t] / rec->term_frequency_vec[0]; - relevance += termfreq * idfvec[t]; + relevance += 100000 * (termfreq * idfvec[t] + 0.0000005); } - rec->relevance = (int) (relevance * 100000); + rec->relevance = relevance; } reclist_rewind(reclist); xfree(idfvec);