X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=rset%2Frsprox.c;h=1a846d01e374233c46984f006040c233be12dcab;hb=d8e960f5f1060148a5fffa7a767c72391662fbdc;hp=77aa4a7770dcdce13c451d43aadea32e0b905b91;hpb=d01bdeea950f667ea0ab4eaea212ac6d04f4d97a;p=idzebra-moved-to-github.git diff --git a/rset/rsprox.c b/rset/rsprox.c index 77aa4a7..1a846d0 100644 --- a/rset/rsprox.c +++ b/rset/rsprox.c @@ -1,4 +1,4 @@ -/* $Id: rsprox.c,v 1.24 2005-01-17 01:16:37 adam Exp $ +/* $Id: rsprox.c,v 1.28 2005-05-03 09:11:36 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -25,7 +25,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #ifndef RSET_DEBUG @@ -54,8 +54,6 @@ static const struct rset_control control = r_write, }; -const struct rset_control *rset_kind_prox = &control; - struct rset_prox_info { RSET *rset; /* array of 'child' rsets */ int rset_no; /* how many of them */ @@ -74,10 +72,11 @@ struct rset_prox_rfd { }; -RSET rsprox_create( NMEM nmem, const struct key_control *kcontrol, int scope, - int rset_no, RSET *rset, - int ordered, int exclusion, - int relation, int distance) +RSET rsprox_create(NMEM nmem, struct rset_key_control *kcontrol, + int scope, + int rset_no, RSET *rset, + int ordered, int exclusion, + int relation, int distance) { RSET rnew = rset_create_base(&control, nmem, kcontrol, scope,0); struct rset_prox_info *info; @@ -94,7 +93,6 @@ RSET rsprox_create( NMEM nmem, const struct key_control *kcontrol, int scope, return rnew; } - static void r_delete (RSET ct) { struct rset_prox_info *info = (struct rset_prox_info *) ct->priv; @@ -104,7 +102,6 @@ static void r_delete (RSET ct) rset_delete(info->rset[i]); } - static RSFD r_open (RSET ct, int flag) { struct rset_prox_info *info = (struct rset_prox_info *) ct->priv; @@ -155,11 +152,11 @@ static void r_close (RSFD rfd) rfd_delete_base(rfd); } -static int r_forward (RSFD rfd, void *buf, TERMID *term, const void *untilbuf) +static int r_forward(RSFD rfd, void *buf, TERMID *term, const void *untilbuf) { struct rset_prox_info *info = (struct rset_prox_info *)(rfd->rset->priv); - struct rset_prox_rfd *p=(struct rset_prox_rfd *)(rfd->priv); - const struct key_control *kctrl = rfd->rset->keycontrol; + struct rset_prox_rfd *p = (struct rset_prox_rfd *)(rfd->priv); + const struct rset_key_control *kctrl = rfd->rset->keycontrol; int cmp = 0; int i; @@ -245,7 +242,7 @@ static int r_forward (RSFD rfd, void *buf, TERMID *term, const void *untilbuf) for (i = 0; igetseq)(p->buf[1]) - seqno[i]; + zint diff = (*kctrl->getseq)(p->buf[1]) - seqno[i]; int excl = info->exclusion; if (!info->ordered && diff < 0) diff = -diff; @@ -333,7 +330,7 @@ static void r_pos (RSFD rfd, double *current, double *total) *total = 0; } else { r = scur/stot; - *current = p->hits; + *current = (double) p->hits; *total=*current/r ; } yaz_log(YLOG_DEBUG,"prox_pos: [%d] %0.1f/%0.1f= %0.4f ",