-/* $Id: zrpn.c,v 1.196 2005-06-07 07:41:05 adam Exp $
+/* $Id: zrpn.c,v 1.198 2005-06-09 10:39:53 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
grep_info->isam_p_indx, term_dst,
strlen(term_dst), rank_type, 1 /* preserve pos */,
zapt->term->which, rset_nmem,
- kc, kc->scope, ol);
+ kc, kc->scope, ol, reg_type);
if (!*rset)
return ZEBRA_FAIL;
return ZEBRA_OK;
strlen(term_dst), rank_type,
0 /* preserve position */,
zapt->term->which, rset_nmem,
- kc, kc->scope, 0);
+ kc, kc->scope, 0, reg_type);
if (!result_sets[num_result_sets])
break;
num_result_sets++;
rset = rset_trunc(zh, grep_info.isam_p_buf,
grep_info.isam_p_indx, term, strlen(term),
flags, 1, term_type,rset_nmem,
- kc, kc->scope, 0);
+ kc, kc->scope, 0, reg_type);
grep_info_delete(&grep_info);
return rset;
}
*dst = nmem_strdup(stream, term_src);
}
-static void count_set (RSET r, int *count)
+static void count_set(ZebraHandle zh, RSET rset, zint *count)
{
zint psysno = 0;
- int kno = 0;
struct it_key key;
RSFD rfd;
yaz_log(YLOG_DEBUG, "count_set");
+ rset->hits_limit = zh->approx_limit;
+
*count = 0;
- rfd = rset_open (r, RSETF_READ);
- while (rset_read (rfd, &key,0 /* never mind terms */))
+ rfd = rset_open(rset, RSETF_READ);
+ while (rset_read(rfd, &key,0 /* never mind terms */))
{
if (key.mem[0] != psysno)
{
psysno = key.mem[0];
- (*count)++;
+ if (rfd->counted_items >= rset->hits_limit)
+ break;
}
- kno++;
}
rset_close (rfd);
- yaz_log(YLOG_DEBUG, "%d keys, %d records", kno, *count);
+ *count = rset->hits_count;
}
ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
rset = rset_trunc(zh, &scan_info_array[j0].list[ptr[j0]].isam_p, 1,
glist[lo].term, strlen(glist[lo].term),
NULL, 0, zapt->term->which, rset_nmem,
- kc, kc->scope, 0);
+ kc, kc->scope, 0, reg_id);
}
ptr[j0]++; /* move index for this set .. */
/* get result set for remaining scan terms */
glist[lo].term,
strlen(glist[lo].term), NULL, 0,
zapt->term->which,rset_nmem,
- kc, kc->scope, 0);
+ kc, kc->scope, 0, reg_id);
rset = rsmulti_or_create(rset_nmem, kc,
kc->scope, 0 /* termid */,
2, rsets);
}
if (lo >= 0)
{
+ zint count;
/* merge with limit_set if given */
if (limit_set)
{
2, rsets);
}
/* count it */
- count_set(rset, &glist[lo].occurrences);
+ count_set(zh, rset, &count);
+ glist[lo].occurrences = count;
rset_delete(rset);
}
}
const char *tst;
RSET rset;
int lo = before-1-i; /* offset in result list */
+ zint count;
for (j = 0; j <ord_no; j++)
{
(zh, &scan_info_array[j0].list[before-1-ptr[j0]].isam_p, 1,
glist[lo].term, strlen(glist[lo].term),
NULL, 0, zapt->term->which, rset_nmem,
- kc, kc->scope, 0);
+ kc, kc->scope, 0, reg_id);
ptr[j0]++;
glist[lo].term,
strlen(glist[lo].term), NULL, 0,
zapt->term->which, rset_nmem,
- kc, kc->scope, 0);
+ kc, kc->scope, 0, reg_id);
rset = rsmulti_or_create(rset_nmem, kc,
kc->scope, 0 /* termid */, 2, rsets);
rset = rsmulti_and_create(rset_nmem, kc,
kc->scope, 2, rsets);
}
- count_set (rset, &glist[lo].occurrences);
+ count_set(zh, rset, &count);
+ glist[lo].occurrences = count;
rset_delete (rset);
}
(*kc->dec)(kc);