55 const void *untilbuf);
57 const void *untilbuf);
58 static void r_pos_and(
RSFD rfd,
double *current,
double *total);
59 static void r_pos_or(
RSFD rfd,
double *current,
double *total);
155 int cur = 1, child = 2;
158 while (child <= h->heapnum)
160 if (child < h->heapnum &&
heap_cmp(h, child, 1 + child) > 0)
179 int cur = 1, child = 2;
180 while (child <= h->heapnum)
182 if (child < h->heapnum &&
heap_cmp(h, child, 1 + child) > 0)
200 assert(cur <= h->heapmax);
203 while (parent && (
heap_cmp(h,parent,cur) > 0))
215 HEAP h = (
HEAP) nmem_malloc(nmem,
sizeof(*h));
244 double cur, totx, toty;
247 if (totx > toty + 0.5)
249 if (totx < toty - 0.5)
257 int no_rsets,
RSET* rsets,
265 log_level = yaz_log_module_level(
"rsmultiandor");
268 yaz_log(
log_level,
"rsmultiand_andor_create scope=%d", scope);
278 no_rsets, rsets, &control_or);
285 no_rsets, rsets, &control_and);
301 yaz_log(YLOG_FATAL,
"multiandor set type is read-only");
381 TERMID *term,
const void *untilbuf)
419 it = mrfd->
h->
heap[1];
524 while (i < ct->no_children)
561 const void *untilbuf)
594 static void r_pos_x(
RSFD rfd,
double *current,
double *total,
int and_op)
598 double ratio = and_op ? 0.0 : 1.0;
600 double sum_cur = 0.0;
601 double sum_tot = 0.0;
607 yaz_log(
log_level,
"r_pos: %d %0.1f %0.1f", i, cur,tot);
612 double nratio = cur / tot;
620 sum_cur += (cur - 1);
624 if (!and_op && sum_tot > 0.0)
626 yaz_log(YLOG_LOG,
"or op sum_cur=%0.1f sum_tot=%0.1f hits=%f", sum_cur, sum_tot, (
double) mrfd->
hits);
627 ratio = sum_cur / sum_tot;
629 if (ratio == 0.0 || ratio == 1.0)
633 yaz_log(
log_level,
"r_pos: NULL %0.1f %0.1f", *current, *total);
637 *current = (double) (mrfd->
hits);
638 *total = *current / ratio;
639 yaz_log(
log_level,
"r_pos: = %0.1f %0.1f", *current, *total);
645 r_pos_x(rfd, current, total, 1);
650 r_pos_x(rfd, current, total, 0);
655 yaz_log(YLOG_FATAL,
"multior set type is read-only");
669 int firstterm = *curterm;
674 if (*curterm > firstterm + 1 && *curterm <= maxterms &&
675 terms[(*curterm) - 1] == terms[firstterm])