X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=index%2Fzvrank.c;h=8c1a034848de16a53a13069aa065c43895c072e9;hb=e36276b23b7a9c64fbb8c4296859c95f0e02c9be;hp=622278ef49eb0c78243ad25cc487b0f491689ef7;hpb=00c427dace60183f4ba7bacdcdf004ac419527ce;p=idzebra-moved-to-github.git diff --git a/index/zvrank.c b/index/zvrank.c index 622278e..8c1a034 100644 --- a/index/zvrank.c +++ b/index/zvrank.c @@ -1,4 +1,4 @@ -/* $Id: zvrank.c,v 1.6 2004-06-08 13:27:48 marc Exp $ +/* $Id: zvrank.c,v 1.7.2.1 2004-11-04 12:49:36 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -660,9 +660,10 @@ static void *zv_create (ZebraHandle zh) { struct rank_class_info *ci = (struct rank_class_info *) xmalloc (sizeof(*ci)); yaz_log(LOG_DEBUG, "zv_create"); - wscheme=res_get(res, "zvrank.weighting-scheme"); - for (i=0; (i < strlen(wscheme)) && (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; } @@ -778,6 +779,10 @@ static int zv_calc (void *rsi, int sysno) yaz_log (LOG_LOG, "sysno=%d score=%d", sysno, score); if (score > 1000) /* should not happen */ score = 1000; + /* reset counts for the next record */ + for (i = 0; i < rs->veclen; i++) + rs->rdoc->terms[i].locc=0; + return score; }