X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzvrank.c;h=c2fc2182fcf64253027c5d94a7c48df25d6c4bcf;hb=f7a3769dede0071696bdcc13ae2ee1efe6d52d96;hp=a6d21533cc2baa5136abd6f84023aba33fb3f65a;hpb=06dec5f5b1364f4c31d1858f35a16f61d325120a;p=idzebra-moved-to-github.git diff --git a/index/zvrank.c b/index/zvrank.c index a6d2153..c2fc218 100644 --- a/index/zvrank.c +++ b/index/zvrank.c @@ -1,6 +1,6 @@ -/* $Id: zvrank.c,v 1.14 2004-11-19 15:52:58 heikki Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 - Index Data Aps +/* $Id: zvrank.c,v 1.21 2006-05-10 08:13:26 adam Exp $ + Copyright (C) 1995-2005 + Index Data ApS This file is part of the Zebra server. @@ -52,9 +52,10 @@ fernuni-hagen.de> #endif #include "index.h" +#include "rank.h" -static int log_level=0; -static int log_initialized=0; +static int log_level = 0; +static int log_initialized = 0; static double blog(double x) { /* log_2, log_e or log_10 is used, best to change it here if necessary */ @@ -342,7 +343,7 @@ static void idf_squared(void *rsi, void *dsi) { if (gocc==0) idf=0.0; else - idf=blog(num_docs/gocc); + idf=blog(CAST_ZINT_TO_DOUBLE(num_docs/gocc)); idf=idf*idf; ds->terms[i].idf=idf; } @@ -669,13 +670,13 @@ static void *zv_create (ZebraHandle zh) { xmalloc (sizeof(*ci)); if (!log_initialized) { - log_level=yaz_log_module_level("zvrank"); - log_initialized=1; + log_level = yaz_log_module_level("zvrank"); + log_initialized = 1; } yaz_log(log_level, "zv_create"); - wscheme=res_get_def(res, "zvrank.weighting-scheme", ""); - for (i=0; wscheme[i] && i < 8; i++) + wscheme= res_get_def(res, "zvrank.weighting-scheme", ""); + for (i = 0; wscheme[i] && i < 8; i++) ci->rscheme[i]=wscheme[i]; ci->rscheme[i] = '\0'; return ci; @@ -782,7 +783,7 @@ static void zv_add (void *rsi, int seqno, TERMID term) { * score should be between 0 and 1000. If score cannot be obtained * -1 should be returned. */ -static int zv_calc (void *rsi, zint sysno) +static int zv_calc (void *rsi, zint sysno, zint staticrank, int *stop_flag) { int i, veclen; int score=0; @@ -839,6 +840,13 @@ static struct rank_control rank_control_vsm = { zv_add, }; -struct rank_control *rankzv_class = &rank_control_vsm; +struct rank_control *rank_zv_class = &rank_control_vsm; + +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ -/* EOF */