From 15be149c731f9d56905d2544b807a56af872161a Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Thu, 4 Nov 2004 12:49:36 +0000 Subject: [PATCH] Resetting occurrence counts in calc, so that the next record gets a good zvrank. Thanks to Poroshin Vladimir for the bug report. --- examples/zthes/zebra.cfg | 3 ++- index/zvrank.c | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/zthes/zebra.cfg b/examples/zthes/zebra.cfg index 05fbc08..e09d700 100644 --- a/examples/zthes/zebra.cfg +++ b/examples/zthes/zebra.cfg @@ -1,5 +1,6 @@ -# $Id: zebra.cfg,v 1.5 2002-12-30 12:56:07 adam Exp $ +# $Id: zebra.cfg,v 1.5.2.1 2004-11-04 12:49:36 heikki Exp $ profilePath: .:../../tab recordType: grs.sgml attset: zthes.att attset: bib1.att +ranking: zvrank diff --git a/index/zvrank.c b/index/zvrank.c index 4322dda..8c1a034 100644 --- a/index/zvrank.c +++ b/index/zvrank.c @@ -1,4 +1,4 @@ -/* $Id: zvrank.c,v 1.8 2004-08-04 08:35:24 adam 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 @@ -757,7 +757,7 @@ static void zv_add (void *rsi, int seqno, int i) { * 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, int sysno) { int i, veclen; int score=0; @@ -776,9 +776,13 @@ static int zv_calc (void *rsi, zint sysno) dscore=rs->sim_fct(rs->qdoc, rs->rdoc); } score = dscore * 1000; - yaz_log (LOG_LOG, "sysno=" ZINT_FORMAT " score=%d", sysno, score); + 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; } -- 1.7.10.4