-/* $Id: rset.h,v 1.44 2005-01-15 19:38:24 adam Exp $
+/* $Id: rset.h,v 1.45 2005-01-15 20:47:15 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
02111-1307, USA.
*/
-
-
#ifndef RSET_H
#define RSET_H
-#include <stdlib.h>
+#include <stddef.h>
/* unfortunately we need the isam includes here, for the arguments for */
/* rsisamX_create */
#include <idzebra/isamc.h>
#include <idzebra/isams.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+YAZ_BEGIN_CDECL
typedef struct rsfd *RSFD; /* Rset "file descriptor" */
typedef struct rset *RSET; /* Result set */
/* int rset_pos(RSFD fd, double *current, double *total); */
#define rset_pos(rfd,cur,tot) \
- (*(rfd)->rset->control->f_pos)( (rfd),(cur),(tot))
+ (*(rfd)->rset->control->f_pos)((rfd),(cur),(tot))
/* int rset_read(RSFD rfd, void *buf, TERMID term); */
#define rset_read(rfd, buf, term) \
/** rset_count counts or estimates the keys in it*/
zint rset_count(RSET rs);
-RSET rstemp_create( NMEM nmem, const struct key_control *kcontrol,
+RSET rstemp_create(NMEM nmem, const struct key_control *kcontrol,
int scope,
const char *temp_path, TERMID term);
RSET rsnull_create(NMEM nmem, const struct key_control *kcontrol);
-RSET rsbool_create_and( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- RSET rset_l, RSET rset_r);
+RSET rsbool_create_and(NMEM nmem, const struct key_control *kcontrol,
+ int scope, RSET rset_l, RSET rset_r);
-RSET rsbool_create_or ( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- RSET rset_l, RSET rset_r);
+RSET rsbool_create_or (NMEM nmem, const struct key_control *kcontrol,
+ int scope, RSET rset_l, RSET rset_r);
-RSET rsbool_create_not( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- RSET rset_l, RSET rset_r);
+RSET rsbool_create_not(NMEM nmem, const struct key_control *kcontrol,
+ int scope, RSET rset_l, RSET rset_r);
-RSET rsbetween_create( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- RSET rset_l, RSET rset_m, RSET rset_r,
- RSET rset_attr);
+RSET rsbetween_create(NMEM nmem, const struct key_control *kcontrol,
+ int scope, RSET rset_l, RSET rset_m, RSET rset_r,
+ RSET rset_attr);
-RSET rsmultior_create( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- int no_rsets, RSET* rsets);
+RSET rsmulti_or_create(NMEM nmem, const struct key_control *kcontrol,
+ int scope, int no_rsets, RSET* rsets);
-RSET rsmultiand_create( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- int no_rsets, RSET* rsets);
+RSET rsmulti_and_create(NMEM nmem, const struct key_control *kcontrol,
+ int scope, int no_rsets, RSET* rsets);
-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, const struct key_control *kcontrol,
+ int scope, int rset_no, RSET *rset,
+ int ordered, int exclusion, int relation, int distance);
-RSET rsisamb_create( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- ISAMB is, ISAMB_P pos,
- TERMID term);
+RSET rsisamb_create(NMEM nmem, const struct key_control *kcontrol,
+ int scope, ISAMB is, ISAMB_P pos, TERMID term);
-RSET rsisamc_create( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- ISAMC is, ISAMC_P pos,
- TERMID term);
+RSET rsisamc_create(NMEM nmem, const struct key_control *kcontrol,
+ int scope, ISAMC is, ISAMC_P pos, TERMID term);
-RSET rsisams_create( NMEM nmem, const struct key_control *kcontrol,
- int scope,
- ISAMS is, ISAMS_P pos,
- TERMID term);
+RSET rsisams_create(NMEM nmem, const struct key_control *kcontrol,
+ int scope, ISAMS is, ISAMS_P pos, TERMID term);
-
-#ifdef __cplusplus
-}
-#endif
+YAZ_END_CDECL
#endif
-/* $Id: trunc.c,v 1.50 2005-01-15 19:38:28 adam Exp $
+/* $Id: trunc.c,v 1.51 2005-01-15 20:47:15 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
int (*cmp)(const void *p1,
const void *p2))
{
- struct trunc_info *ti = (struct trunc_info *) xmalloc (sizeof(*ti));
+ struct trunc_info *ti = (struct trunc_info *) xmalloc(sizeof(*ti));
int i;
++size;
ti->heapnum = 0;
ti->keysize = key_size;
ti->cmp = cmp;
- ti->indx = (int *) xmalloc (size * sizeof(*ti->indx));
- ti->heap = (char **) xmalloc (size * sizeof(*ti->heap));
- ti->ptr = (int *) xmalloc (size * sizeof(*ti->ptr));
- ti->swapbuf = (char *) xmalloc (ti->keysize);
- ti->tmpbuf = (char *) xmalloc (ti->keysize);
- ti->buf = (char *) xmalloc (size * ti->keysize);
+ ti->indx = (int *) xmalloc(size * sizeof(*ti->indx));
+ ti->heap = (char **) xmalloc(size * sizeof(*ti->heap));
+ ti->ptr = (int *) xmalloc(size * sizeof(*ti->ptr));
+ ti->swapbuf = (char *) xmalloc(ti->keysize);
+ ti->tmpbuf = (char *) xmalloc(ti->keysize);
+ ti->buf = (char *) xmalloc(size * ti->keysize);
for (i = size; --i >= 0; )
{
ti->ptr[i] = i;
static void heap_close (struct trunc_info *ti)
{
- xfree (ti->ptr);
- xfree (ti->indx);
- xfree (ti->heap);
- xfree (ti->swapbuf);
- xfree (ti->tmpbuf);
- xfree (ti->buf);
- xfree (ti);
+ xfree(ti->ptr);
+ xfree(ti->indx);
+ xfree(ti->heap);
+ xfree(ti->swapbuf);
+ xfree(ti->tmpbuf);
+ xfree(ti->buf);
+ xfree(ti);
}
static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length,
parms.temp_path = res_get (zi->res, "setTmpDir");
result = rset_create (rset_kind_temp, &parms);
*/
- result=rstemp_create( rset_nmem,kctrl, scope,
+ result = rstemp_create( rset_nmem,kctrl, scope,
res_get (zi->res, "setTmpDir"), termid);
result_rsfd = rset_open (result, RSETF_WRITE);
int rscur = 0;
int rsmax = (to-from)/i_add + 1;
- rset = (RSET *) xmalloc (sizeof(*rset) * rsmax);
- rsfd = (RSFD *) xmalloc (sizeof(*rsfd) * rsmax);
+ rset = (RSET *) xmalloc(sizeof(*rset) * rsmax);
+ rsfd = (RSFD *) xmalloc(sizeof(*rsfd) * rsmax);
for (i = from; i < to; i += i_add)
{
}
}
}
- xfree (rset);
- xfree (rsfd);
+ xfree(rset);
+ xfree(rsfd);
heap_close (ti);
}
else if (zi->reg->isamc)
int i;
struct trunc_info *ti;
- ispt = (ISAMC_PP *) xmalloc (sizeof(*ispt) * (to-from));
+ ispt = (ISAMC_PP *) xmalloc(sizeof(*ispt) * (to-from));
ti = heap_init (to-from, sizeof(struct it_key),
key_compare_it);
}
}
heap_close (ti);
- xfree (ispt);
+ xfree(ispt);
}
else if (zi->reg->isams)
{
struct trunc_info *ti;
int nn = 0;
- ispt = (ISAMS_PP *) xmalloc (sizeof(*ispt) * (to-from));
+ ispt = (ISAMS_PP *) xmalloc(sizeof(*ispt) * (to-from));
ti = heap_init (to-from, sizeof(struct it_key),
key_compare_it);
}
}
heap_close (ti);
- xfree (ispt);
+ xfree(ispt);
}
else if (zi->reg->isamb)
{
int i;
struct trunc_info *ti;
- ispt = (ISAMB_PP *) xmalloc (sizeof(*ispt) * (to-from));
+ ispt = (ISAMB_PP *) xmalloc(sizeof(*ispt) * (to-from));
ti = heap_init (to-from, sizeof(struct it_key),
key_compare_it);
}
}
heap_close (ti);
- xfree (ispt);
+ xfree(ispt);
}
else
yaz_log (YLOG_WARN, "Unknown isam set in rset_trunc_r");
yaz_log (YLOG_DEBUG, "rset_trunc no=%d", no);
if (no < 1)
return rsnull_create (rset_nmem,kctrl);
- termid=rset_term_create(term, length, flags, term_type,rset_nmem);
+ termid = rset_term_create(term, length, flags, term_type,rset_nmem);
if (zi->reg->isams)
{
if (no == 1)
else if (no <10000 ) /* FIXME - hardcoded number */
{
RSET r;
- RSET *rsets=xmalloc(no*sizeof(RSET)); /* use nmem! */
+ RSET *rsets = xmalloc(no*sizeof(RSET)); /* use nmem! */
int i;
- for (i=0;i<no;i++)
+ for (i = 0; i<no; i++)
rsets[i]=rsisamb_create(rset_nmem, kctrl, scope,
zi->reg->isamb, isam_p[i], termid);
- r=rsmultior_create( rset_nmem, kctrl, scope, no, rsets);
+ r = rsmulti_or_create( rset_nmem, kctrl, scope, no, rsets);
xfree(rsets);
return r;
}
-/* $Id: zrpn.c,v 1.167 2005-01-15 19:38:29 adam Exp $
+/* $Id: zrpn.c,v 1.168 2005-01-15 20:47:15 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
} AttrType;
-static int log_level_set=0;
-static int log_level_rpn=0;
+static int log_level_set = 0;
+static int log_level_rpn = 0;
static const char **rpn_char_map_handler(void *vp, const char **from, int len)
{
while (*src)
{
const char *cp = zebra_maps_output(zh->reg->zebra_maps,
- reg_type, &src);
+ reg_type, &src);
if (!cp && len < IT_MAX_WORD-1)
dst[len++] = *src++;
else
if (!log_level_set)
{
log_level_rpn = yaz_log_module_level("rpn");
- log_level_set=1;
+ log_level_set = 1;
}
if (p->isam_p_indx == p->isam_p_size)
{
p->isam_p_buf = new_isam_p_buf;
#ifdef TERM_COUNT
- new_term_no = (int *) xmalloc(sizeof(*new_term_no) *
- p->isam_p_size);
+ new_term_no = (int *) xmalloc(sizeof(*new_term_no) * p->isam_p_size);
if (p->term_no)
{
memcpy(new_term_no, p->isam_p_buf,
#define REGEX_CHARS " []()|.*+?!"
-/* term_100: handle term, where trunc=none(no operators at all) */
+/* term_100: handle term, where trunc = none(no operators at all) */
static int term_100(ZebraMaps zebra_maps, int reg_type,
const char **src, char *dst, int space_split,
char *dst_term)
return i;
}
-/* term_101: handle term, where trunc=Process # */
+/* term_101: handle term, where trunc = Process # */
static int term_101(ZebraMaps zebra_maps, int reg_type,
const char **src, char *dst, int space_split,
char *dst_term)
return i;
}
-/* term_103: handle term, where trunc=re-2 (regular expressions) */
+/* term_103: handle term, where trunc = re-2 (regular expressions) */
static int term_103(ZebraMaps zebra_maps, int reg_type, const char **src,
char *dst, int *errors, int space_split,
char *dst_term)
return i;
}
-/* term_103: handle term, where trunc=re-1 (regular expressions) */
+/* term_103: handle term, where trunc = re-1 (regular expressions) */
static int term_102 (ZebraMaps zebra_maps, int reg_type, const char **src,
char *dst, int space_split, char *dst_term)
{
}
-/* term_104: handle term, where trunc=Process # and ! */
+/* term_104: handle term, where trunc = Process # and ! */
static int term_104(ZebraMaps zebra_maps, int reg_type,
const char **src, char *dst, int space_split,
char *dst_term)
return i;
}
-/* term_105/106: handle term, where trunc=Process * and ! and right trunc */
+/* term_105/106: handle term, where trunc = Process * and ! and right trunc */
static int term_105 (ZebraMaps zebra_maps, int reg_type,
const char **src, char *dst, int space_split,
char *dst_term, int right_truncate)
{
/* match everything less than 10^(pos-1) */
strcat(dst, "0*");
- for (i=1; i<pos; i++)
+ for (i = 1; i<pos; i++)
strcat(dst, "[0-9]?");
}
else
}
else
{
- if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value,
+ if ((r = att_getentbyatt (zh, &attp, curAttributeSet, use_value,
use_string)))
{
yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d",
grep_info_delete (&grep_info);
if (rset_no == 0)
return rsnull_create (rset_nmem,key_it_ctrl);
- return rsmultior_create(rset_nmem, key_it_ctrl,key_it_ctrl->scope,
- rset_no, rset);
+ return rsmulti_or_create(rset_nmem, key_it_ctrl,key_it_ctrl->scope,
+ rset_no, rset);
}
static RSET rpn_search_APT_and_list (ZebraHandle zh,
}
grep_info_delete (&grep_info);
if (rset_no == 0)
- return rsnull_create (rset_nmem,key_it_ctrl);
-
- return rsmultiand_create( rset_nmem, key_it_ctrl, key_it_ctrl->scope,
- rset_no, rset);
+ return rsnull_create(rset_nmem,key_it_ctrl);
+
+ return rsmulti_and_create(rset_nmem, key_it_ctrl, key_it_ctrl->scope,
+ rset_no, rset);
}
static int numeric_relation (ZebraHandle zh, Z_AttributesPlusTerm *zapt,
r = dict_lookup_grep(zh->reg->dict, term_dict, 0, grep_info, max_pos,
0, grep_handle);
if (r)
- yaz_log(YLOG_WARN, "dict_lookup_grep fail, rel=gt: %d", r);
+ yaz_log(YLOG_WARN, "dict_lookup_grep fail, rel = gt: %d", r);
yaz_log(log_level_rpn, "%d positions", grep_info->isam_p_indx);
return 1;
}
}
else
{
- if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value,
+ if ((r = att_getentbyatt (zh, &attp, curAttributeSet, use_value,
use_string)))
{
yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d",
}
grep_info_delete (&grep_info);
if (rset_no == 0)
- return rsnull_create (rset_nmem,key_it_ctrl);
+ return rsnull_create(rset_nmem,key_it_ctrl);
if (rset_no == 1)
return rset[0];
- return rsmultiand_create(rset_nmem,key_it_ctrl,key_it_ctrl->scope,
- rset_no, rset);
+ return rsmulti_and_create(rset_nmem,key_it_ctrl,key_it_ctrl->scope,
+ rset_no, rset);
}
static RSET rpn_search_APT_local (ZebraHandle zh, Z_AttributesPlusTerm *zapt,
/ -> none
- a[@attr=value]/b[@other=othervalue]
+ a[@attr = value]/b[@other = othervalue]
/e/@a val range(e/,range(@a,freetext(w,1015,val),@a),e/)
/a/b val range(b/a/,freetext(w,1016,val),b/a/)
/a/b/@c val range(b/a/,range(@c,freetext(w,1016,val),@c),b/a/)
- /a/b[@c=y] val range(b/a/,freetext(w,1016,val),b/a/,@c=y)
- /a[@c=y]/b val range(a/,range(b/a/,freetext(w,1016,val),b/a/),a/,@c=y)
- /a[@c=x]/b[@c=y] range(a/,range(b/a/,freetext(w,1016,val),b/a/,@c=y),a/,@c=x)
+ /a/b[@c = y] val range(b/a/,freetext(w,1016,val),b/a/,@c = y)
+ /a[@c = y]/b val range(a/,range(b/a/,freetext(w,1016,val),b/a/),a/,@c = y)
+ /a[@c = x]/b[@c = y] range(a/,range(b/a/,freetext(w,1016,val),b/a/,@c = y),a/,@c = x)
*/
rset_end_tag = xpath_trunc(zh, stream, '0',
xpath_rev, 2, curAttributeSet, rset_nmem);
- /*
- parms.key_size = sizeof(struct it_key);
- parms.cmp = key_compare_it;
- parms.rset_l = rset_start_tag;
- parms.rset_m = rset;
- parms.rset_r = rset_end_tag;
- parms.rset_attr = rset_attr;
- parms.printer = key_print_it;
- rset = rset_create (rset_kind_between, &parms);
- */
- rset=rsbetween_create( rset_nmem,key_it_ctrl,key_it_ctrl->scope,
- rset_start_tag, rset, rset_end_tag, rset_attr);
+ rset = rsbetween_create(rset_nmem, key_it_ctrl,
+ key_it_ctrl->scope,
+ rset_start_tag, rset,
+ rset_end_tag, rset_attr);
}
first_path = 0;
}
if (!log_level_set)
{
log_level_rpn = yaz_log_module_level("rpn");
- log_level_set=1;
+ log_level_set = 1;
}
zebra_maps_attr (zh->reg->zebra_maps, zapt, ®_id, &search_type,
rank_type, &complete_flag, &sort_flag);
switch (zop->which)
{
case Z_Operator_and:
- r=rsmultiand_create(rset_nmem, key_it_ctrl, key_it_ctrl->scope,
- 2, rsets);
+ r = rsmulti_and_create(rset_nmem, key_it_ctrl, key_it_ctrl->scope,
+ 2, rsets);
break;
case Z_Operator_or:
- r=rsmultior_create(rset_nmem, key_it_ctrl, key_it_ctrl->scope,
- 2, rsets);
+ r = rsmulti_or_create(rset_nmem, key_it_ctrl, key_it_ctrl->scope,
+ 2, rsets);
break;
case Z_Operator_and_not:
r = rsbool_create_not(rset_nmem,key_it_ctrl, key_it_ctrl->scope,
else
{
/* new / old prox */
- r=rsprox_create(rset_nmem,key_it_ctrl,key_it_ctrl->scope,
+ r = rsprox_create(rset_nmem,key_it_ctrl,key_it_ctrl->scope,
2, rsets,
*zop->u.prox->ordered,
(!zop->u.prox->exclusion ?
char rank_type[128];
int complete_flag;
int sort_flag;
- NMEM rset_nmem=NULL;
+ NMEM rset_nmem = NULL;
*list = 0;
attent attp;
data1_local_attribute *local_attr;
- if ((r=att_getentbyatt (zh, &attp, attributeset, use_value,
+ if ((r = att_getentbyatt (zh, &attp, attributeset, use_value,
use_string)))
{
yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d",
if (trans_scan_term(zh, zapt, termz+prefix_len, reg_id))
return ;
-
+
dict_scan(zh->reg->dict, termz, &before_tmp, &after_tmp,
scan_info, scan_handle);
}
for (j = 0; j < ord_no; j++)
{
if (ptr[j] < before+after &&
- (tst=scan_info_array[j].list[ptr[j]].term) &&
+ (tst = scan_info_array[j].list[ptr[j]].term) &&
(!mterm || strcmp (tst, mterm) < 0))
{
j0 = j;
scan_term_untrans (zh, stream->mem, reg_id,
&glist[i+before].term, mterm);
rset = rset_trunc(zh, &scan_info_array[j0].list[ptr[j0]].isam_p, 1,
- glist[i+before].term, strlen(glist[i+before].term),
- NULL, 0, zapt->term->which, rset_nmem,
- key_it_ctrl,key_it_ctrl->scope);
+ glist[i+before].term, strlen(glist[i+before].term),
+ NULL, 0, zapt->term->which, rset_nmem,
+ key_it_ctrl,key_it_ctrl->scope);
ptr[j0]++;
for (j = j0+1; j<ord_no; j++)
{
if (ptr[j] < before+after &&
- (tst=scan_info_array[j].list[ptr[j]].term) &&
+ (tst = scan_info_array[j].list[ptr[j]].term) &&
!strcmp (tst, mterm))
{
- RSET rset2;
-
- rset2 =
- rset_trunc(zh, &scan_info_array[j].list[ptr[j]].isam_p, 1,
- glist[i+before].term,
- strlen(glist[i+before].term), NULL, 0,
- zapt->term->which,rset_nmem,
- key_it_ctrl, key_it_ctrl->scope);
- rset = rsbool_create_or(rset_nmem,key_it_ctrl,
- key_it_ctrl->scope, rset, rset2);
- /* FIXME - Use a proper multi-or */
-
+ RSET rsets[2];
+
+ rsets[0] = rset;
+ rsets[1] =
+ rset_trunc(zh, &scan_info_array[j].list[ptr[j]].isam_p, 1,
+ glist[i+before].term,
+ strlen(glist[i+before].term), NULL, 0,
+ zapt->term->which,rset_nmem,
+ key_it_ctrl, key_it_ctrl->scope);
+ rset = rsmulti_or_create(rset_nmem, key_it_ctrl,
+ 2, key_it_ctrl->scope, rsets);
ptr[j]++;
}
}
if (limit_set)
- rset = rsbool_create_and(rset_nmem,key_it_ctrl,key_it_ctrl->scope,
- rset, rset_dup(limit_set));
- count_set (rset, &glist[i+before].occurrences);
- rset_delete (rset);
+ {
+ RSET rsets[2];
+ rsets[0] = rset;
+ rsets[1] = rset_dup(limit_set);
+
+ rset = rsmulti_and_create(rset_nmem, key_it_ctrl,
+ key_it_ctrl->scope, 2, rsets);
+ }
+ count_set(rset, &glist[i+before].occurrences);
+ rset_delete(rset);
}
if (i < after)
{
- *num_entries -= (after-i);
- *is_partial = 1;
+ *num_entries -= (after-i);
+ *is_partial = 1;
}
-
+
/* consider terms before main term */
for (i = 0; i<ord_no; i++)
- ptr[i] = 0;
-
+ ptr[i] = 0;
+
for (i = 0; i<before; i++)
{
- int j, j0 = -1;
- const char *mterm = NULL;
- const char *tst;
- RSET rset;
-
- for (j = 0; j <ord_no; j++)
- {
- if (ptr[j] < before &&
- (tst=scan_info_array[j].list[before-1-ptr[j]].term) &&
- (!mterm || strcmp (tst, mterm) > 0))
- {
- j0 = j;
- mterm = tst;
- }
- }
- if (j0 == -1)
- break;
-
- scan_term_untrans (zh, stream->mem, reg_id,
- &glist[before-1-i].term, mterm);
-
- rset = rset_trunc
- (zh, &scan_info_array[j0].list[before-1-ptr[j0]].isam_p, 1,
- glist[before-1-i].term, strlen(glist[before-1-i].term),
- NULL, 0, zapt->term->which,rset_nmem,
- key_it_ctrl,key_it_ctrl->scope);
-
- ptr[j0]++;
-
- for (j = j0+1; j<ord_no; j++)
- {
- if (ptr[j] < before &&
- (tst=scan_info_array[j].list[before-1-ptr[j]].term) &&
- !strcmp (tst, mterm))
- {
- RSET rset2;
-
- rset2 = rset_trunc(
+ int j, j0 = -1;
+ const char *mterm = NULL;
+ const char *tst;
+ RSET rset;
+
+ for (j = 0; j <ord_no; j++)
+ {
+ if (ptr[j] < before &&
+ (tst = scan_info_array[j].list[before-1-ptr[j]].term) &&
+ (!mterm || strcmp (tst, mterm) > 0))
+ {
+ j0 = j;
+ mterm = tst;
+ }
+ }
+ if (j0 == -1)
+ break;
+
+ scan_term_untrans (zh, stream->mem, reg_id,
+ &glist[before-1-i].term, mterm);
+
+ rset = rset_trunc
+ (zh, &scan_info_array[j0].list[before-1-ptr[j0]].isam_p, 1,
+ glist[before-1-i].term, strlen(glist[before-1-i].term),
+ NULL, 0, zapt->term->which,rset_nmem,
+ key_it_ctrl,key_it_ctrl->scope);
+
+ ptr[j0]++;
+
+ for (j = j0+1; j<ord_no; j++)
+ {
+ if (ptr[j] < before &&
+ (tst = scan_info_array[j].list[before-1-ptr[j]].term) &&
+ !strcmp (tst, mterm))
+ {
+ RSET rsets[2];
+
+ rsets[0] = rset;
+ rsets[1] = rset_trunc(
zh,
&scan_info_array[j].list[before-1-ptr[j]].isam_p, 1,
glist[before-1-i].term,
strlen(glist[before-1-i].term), NULL, 0,
zapt->term->which, rset_nmem,
key_it_ctrl, key_it_ctrl->scope);
- rset = rsbool_create_and(rset_nmem,key_it_ctrl,
- key_it_ctrl->scope, rset, rset2);
- /* FIXME - multi-and ?? */
- ptr[j]++;
- }
- }
+ rset = rsmulti_or_create(rset_nmem, key_it_ctrl,
+ 2, key_it_ctrl->scope, rsets);
+
+ ptr[j]++;
+ }
+ }
if (limit_set)
- rset = rsbool_create_and(rset_nmem,key_it_ctrl,key_it_ctrl->scope,
- rset, rset_dup(limit_set));
- count_set (rset, &glist[before-1-i].occurrences);
- rset_delete (rset);
+ {
+ RSET rsets[2];
+ rsets[0] = rset;
+ rsets[1] = rset_dup(limit_set);
+
+ rset = rsmulti_and_create(rset_nmem, key_it_ctrl,
+ key_it_ctrl->scope, 2, rsets);
+ }
+ count_set (rset, &glist[before-1-i].occurrences);
+ rset_delete (rset);
}
i = before-i;
if (i)
*position -= i;
*num_entries -= i;
}
-
+
nmem_destroy(rset_nmem);
*list = glist + i; /* list is set to first 'real' entry */
yaz_log(YLOG_DEBUG, "position = %d, num_entries = %d",
- *position, *num_entries);
+ *position, *num_entries);
if (zh->errCode)
yaz_log(YLOG_DEBUG, "scan error: %d", zh->errCode);
}
-
+
-/* $Id: rsbetween.c,v 1.34 2005-01-15 19:38:33 adam Exp $
+/* $Id: rsbetween.c,v 1.35 2005-01-15 20:47:16 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
* example "Shakespeare" in between "<author>" and </author>. The thing is
* complicated by the inclusion of attributes (from their own rset). If attrs
* specified, they must match the "left" rset (start tag). "Hamlet" between
- * "<title lang=eng>" and "</title>". (This assumes that the attributes are
+ * "<title lang = eng>" and "</title>". (This assumes that the attributes are
* indexed to the same seqno as the tags).
*
*/
zint hits;
};
-static int log_level=0;
-static int log_level_initialized=0;
+static int log_level = 0;
+static int log_level_initialized = 0;
/* make sure that the rset has a term attached. If not, create one */
{
rs->term=
rset_term_create(tag,strlen(tag),"",0,nmem);
- rs->term->rset=rs;
+ rs->term->rset = rs;
}
}
int scope,
RSET rset_l, RSET rset_m, RSET rset_r, RSET rset_attr)
{
- RSET rnew=rset_create_base(&control, nmem, kcontrol, scope,0);
+ RSET rnew = rset_create_base(&control, nmem, kcontrol, scope,0);
struct rset_between_info *info=
(struct rset_between_info *) nmem_malloc(rnew->nmem,sizeof(*info));
RSET rsetarray[4];
- int n=4;
+ int n = 4;
if (!log_level_initialized)
{
- log_level=yaz_log_module_level("rsbetween");
- log_level_initialized=1;
+ log_level = yaz_log_module_level("rsbetween");
+ log_level_initialized = 1;
}
rsetarray[STARTTAG] = rset_l;
rsetarray[HIT] = rset_m;
/* make sure we have decent terms for all rsets. Create dummies if needed*/
checkterm( rsetarray[STARTTAG], "(start)",nmem);
checkterm( rsetarray[STOPTAG], "(start)",nmem);
- info->startterm=rsetarray[STARTTAG]->term;
- info->stopterm=rsetarray[STOPTAG]->term;
+ info->startterm = rsetarray[STARTTAG]->term;
+ info->stopterm = rsetarray[STOPTAG]->term;
if (rset_attr)
{
checkterm( rsetarray[ATTRTAG], "(start)",nmem);
- info->attrterm=rsetarray[ATTRTAG]->term;
- n=4;
+ info->attrterm = rsetarray[ATTRTAG]->term;
+ n = 4;
}
else
{
- info->attrterm=NULL;
- n=3;
+ info->attrterm = NULL;
+ n = 3;
}
- info->andset=rsmultiand_create( nmem, kcontrol, scope, n, rsetarray);
- rnew->priv=info;
+ info->andset = rsmulti_and_create( nmem, kcontrol, scope, n, rsetarray);
+ rnew->priv = info;
yaz_log(log_level,"create rset at %p",rnew);
return rnew;
}
yaz_log (YLOG_FATAL, "between set type is read-only");
return NULL;
}
- rfd=rfd_create_base(ct);
+ rfd = rfd_create_base(ct);
if (rfd->priv)
p=(struct rset_between_rfd *)rfd->priv;
else {
p = (struct rset_between_rfd *) nmem_malloc(ct->nmem, (sizeof(*p)));
- rfd->priv=p;
+ rfd->priv = p;
p->recbuf = nmem_malloc(ct->nmem, (ct->keycontrol->key_size));
p->startbuf = nmem_malloc(ct->nmem, (ct->keycontrol->key_size));
p->attrbuf = nmem_malloc(ct->nmem, (ct->keycontrol->key_size));
}
p->andrfd = rset_open (info->andset, RSETF_READ);
p->hits=-1;
- p->depth=0;
- p->attrdepth=0;
- p->attrbufok=0;
- p->startbufok=0;
+ p->depth = 0;
+ p->attrdepth = 0;
+ p->attrbufok = 0;
+ p->startbufok = 0;
yaz_log(log_level,"open rset=%p rfd=%p", ct, rfd);
return rfd;
}
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
int rc;
yaz_log(log_level, "forwarding ");
- rc=rset_forward(p->andrfd,buf,term,untilbuf);
+ rc = rset_forward(p->andrfd,buf,term,untilbuf);
return rc;
}
{
struct rset_between_info *info =(struct rset_between_info *)rfd->rset->priv;
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
- const struct key_control *kctrl=rfd->rset->keycontrol;
+ const struct key_control *kctrl = rfd->rset->keycontrol;
int cmp;
if (p->attrdepth)
return; /* already found one */
cmp=(kctrl->cmp)(p->startbuf,p->attrbuf);
if (0==cmp) /* and the keys match */
{
- p->attrdepth=p->depth;
+ p->attrdepth = p->depth;
yaz_log(log_level, "found attribute match at depth %d",p->attrdepth);
}
}
{
struct rset_between_info *info =(struct rset_between_info *)rfd->rset->priv;
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
- const struct key_control *kctrl=rfd->rset->keycontrol;
+ const struct key_control *kctrl = rfd->rset->keycontrol;
int cmp;
- TERMID dummyterm=0;
+ TERMID dummyterm = 0;
yaz_log(log_level,"== read: term=%p",term);
if (!term)
term=&dummyterm;
if (p->hits<0)
{/* first time? */
memcpy(p->recbuf,buf,kctrl->key_size);
- p->hits=0;
- cmp=rfd->rset->scope; /* force newrecord */
+ p->hits = 0;
+ cmp = rfd->rset->scope; /* force newrecord */
}
else {
cmp=(kctrl->cmp)(buf,p->recbuf);
if (cmp>=rfd->rset->scope)
{
yaz_log(log_level,"new record");
- p->depth=0;
- p->attrdepth=0;
+ p->depth = 0;
+ p->attrdepth = 0;
memcpy(p->recbuf,buf,kctrl->key_size);
}
p->depth++;
yaz_log(log_level,"read start tag. d=%d",p->depth);
memcpy(p->startbuf,buf,kctrl->key_size);
- p->startbufok=1;
+ p->startbufok = 1;
checkattr(rfd); /* in case we already saw the attr here */
}
else if (*term==info->stopterm)
{
if (p->depth == p->attrdepth)
- p->attrdepth=0; /* ending the tag with attr match */
+ p->attrdepth = 0; /* ending the tag with attr match */
p->depth--;
yaz_log(log_level,"read end tag. d=%d ad=%d",p->depth, p->attrdepth);
}
{
yaz_log(log_level,"read attr");
memcpy(p->attrbuf,buf,kctrl->key_size);
- p->attrbufok=1;
+ p->attrbufok = 1;
checkattr(rfd); /* in case the start tag came first */
}
else
-/* $Id: rsmultiandor.c,v 1.12 2005-01-15 19:38:35 adam Exp $
+/* $Id: rsmultiandor.c,v 1.13 2005-01-15 20:47:16 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
/*
- * This module implements the rsmultior and rsmultiand result sets
+ * This module implements the rsmulti_or and rsmulti_and result sets
*
* rsmultior is based on a heap, from which we find the next hit.
*
char *tailbits;
};
-static int log_level=0;
-static int log_level_initialized=0;
+static int log_level = 0;
+static int log_level_initialized = 0;
/* Heap functions ***********************/
#if 0
-static void heap_dump_item( HEAP h, int i, int level) {
+static void heap_dump_item( HEAP h, int i, int level)
+{
double cur,tot;
if (i>h->heapnum)
return;
{
struct heap_item *swap;
swap = h->heap[x];
- h->heap[x]=h->heap[y];
- h->heap[y]=swap;
+ h->heap[x] = h->heap[y];
+ h->heap[y] = swap;
}
static int heap_cmp(HEAP h, int x, int y)
static void heap_delete (HEAP h)
{ /* deletes the first item in the heap, and balances the rest */
int cur = 1, child = 2;
- h->heap[1]=0; /* been deleted */
+ h->heap[1] = 0; /* been deleted */
heap_swap (h, 1, h->heapnum--);
while (child <= h->heapnum) {
if (child < h->heapnum && heap_cmp(h,child,1+child)>0 )
cur = ++(h->heapnum);
assert(cur <= h->heapmax);
- h->heap[cur]=hi;
+ h->heap[cur] = hi;
parent = cur/2;
while (parent && (heap_cmp(h,parent,cur) > 0))
{
++size; /* heap array starts at 1 */
h->heapnum = 0;
h->heapmax = size;
- h->kctrl=kctrl;
+ h->kctrl = kctrl;
h->heap = (struct heap_item**) nmem_malloc(nmem,size*sizeof(*h->heap));
h->heap[0]=0; /* not used */
return h;
static void heap_clear( HEAP h)
{
assert(h);
- h->heapnum=0;
+ h->heapnum = 0;
}
static void heap_destroy (HEAP h)
int compare_ands(const void *x, const void *y)
{ /* used in qsort to get the multi-and args in optimal order */
/* that is, those with fewest occurrences first */
- const struct heap_item *hx=x;
- const struct heap_item *hy=y;
+ const struct heap_item *hx = x;
+ const struct heap_item *hy = y;
double cur, totx, toty;
rset_pos(hx->fd, &cur, &totx);
rset_pos(hy->fd, &cur, &toty);
- if ( totx > toty +0.5 ) return 1;
- if ( totx < toty -0.5 ) return -1;
+ if ( totx > toty +0.5 )
+ return 1;
+ if ( totx < toty -0.5 )
+ return -1;
return 0; /* return totx - toty, except for overflows and rounding */
}
int scope, int no_rsets, RSET* rsets,
const struct rset_control *ctrl)
{
- RSET rnew=rset_create_base(ctrl, nmem,kcontrol, scope,0);
+ RSET rnew = rset_create_base(ctrl, nmem,kcontrol, scope,0);
struct rset_multiandor_info *info;
if (!log_level_initialized)
{
- log_level=yaz_log_module_level("rsmultiandor");
- log_level_initialized=1;
+ log_level = yaz_log_module_level("rsmultiandor");
+ log_level_initialized = 1;
}
info = (struct rset_multiandor_info *) nmem_malloc(rnew->nmem,sizeof(*info));
- info->no_rsets=no_rsets;
- info->rsets=(RSET*)nmem_malloc(rnew->nmem, no_rsets*sizeof(*rsets));
+ info->no_rsets = no_rsets;
+ info->rsets = (RSET*)nmem_malloc(rnew->nmem, no_rsets*sizeof(*rsets));
memcpy(info->rsets,rsets,no_rsets*sizeof(*rsets));
- rnew->priv=info;
+ rnew->priv = info;
return rnew;
}
-RSET rsmultior_create( NMEM nmem, const struct key_control *kcontrol, int scope,
- int no_rsets, RSET* rsets)
+RSET rsmulti_or_create(NMEM nmem, const struct key_control *kcontrol,
+ int scope, int no_rsets, RSET* rsets)
{
return rsmulti_andor_create(nmem, kcontrol, scope,
no_rsets, rsets, &control_or);
}
-RSET rsmultiand_create( NMEM nmem, const struct key_control *kcontrol, int scope,
- int no_rsets, RSET* rsets)
+RSET rsmulti_and_create(NMEM nmem, const struct key_control *kcontrol,
+ int scope, int no_rsets, RSET* rsets)
{
return rsmulti_andor_create(nmem, kcontrol, scope,
no_rsets, rsets, &control_and);
{
struct rset_multiandor_info *info = (struct rset_multiandor_info *) ct->priv;
int i;
- for(i=0;i<info->no_rsets;i++)
+ for(i = 0; i<info->no_rsets; i++)
rset_delete(info->rsets[i]);
}
yaz_log (YLOG_FATAL, "multiandor set type is read-only");
return NULL;
}
- rfd=rfd_create_base(ct);
+ rfd = rfd_create_base(ct);
if (rfd->priv) {
- p=(struct rset_multiandor_rfd *)rfd->priv;
+ p = (struct rset_multiandor_rfd *)rfd->priv;
if (!is_and)
heap_clear(p->h);
assert(p->items);
}
else {
p = (struct rset_multiandor_rfd *) nmem_malloc (ct->nmem,sizeof(*p));
- rfd->priv=p;
- p->h=0;
- p->tailbits=0;
+ rfd->priv = p;
+ p->h = 0;
+ p->tailbits = 0;
if (is_and)
- p->tailbits=nmem_malloc(ct->nmem, info->no_rsets*sizeof(char) );
+ p->tailbits = nmem_malloc(ct->nmem, info->no_rsets*sizeof(char) );
else
p->h = heap_create( ct->nmem, info->no_rsets, kctrl);
p->items=(struct heap_item *) nmem_malloc(ct->nmem,
info->no_rsets*sizeof(*p->items));
- for (i=0; i<info->no_rsets; i++){
- p->items[i].rset=info->rsets[i];
- p->items[i].buf=nmem_malloc(ct->nmem,kctrl->key_size);
+ for (i = 0; i<info->no_rsets; i++){
+ p->items[i].rset = info->rsets[i];
+ p->items[i].buf = nmem_malloc(ct->nmem,kctrl->key_size);
}
}
p->flag = flag;
- p->hits=0;
- p->eof=0;
- p->tailcount=0;
+ p->hits = 0;
+ p->eof = 0;
+ p->tailcount = 0;
if (is_and)
{ /* read the array and sort it */
- for (i=0; i<info->no_rsets; i++){
- p->items[i].fd=rset_open(info->rsets[i],RSETF_READ);
+ for (i = 0; i<info->no_rsets; i++){
+ p->items[i].fd = rset_open(info->rsets[i],RSETF_READ);
if (!rset_read(p->items[i].fd, p->items[i].buf, &p->items[i].term))
- p->eof=1;
- p->tailbits[i]=0;
+ p->eof = 1;
+ p->tailbits[i] = 0;
}
qsort(p->items, info->no_rsets, sizeof(p->items[0]), compare_ands);
} else
{ /* fill the heap for ORing */
- for (i=0; i<info->no_rsets; i++){
- p->items[i].fd=rset_open(info->rsets[i],RSETF_READ);
+ for (i = 0; i<info->no_rsets; i++){
+ p->items[i].fd = rset_open(info->rsets[i],RSETF_READ);
if ( rset_read(p->items[i].fd, p->items[i].buf, &p->items[i].term))
heap_insert(p->h, &(p->items[i]));
}
static int r_forward_or(RSFD rfd, void *buf,
TERMID *term,const void *untilbuf)
{ /* while heap head behind untilbuf, forward it and rebalance heap */
- struct rset_multiandor_rfd *p=rfd->priv;
- const struct key_control *kctrl=rfd->rset->keycontrol;
+ struct rset_multiandor_rfd *p = rfd->priv;
+ const struct key_control *kctrl = rfd->rset->keycontrol;
if (heap_empty(p->h))
return 0;
while ( (*kctrl->cmp)(p->h->heap[1]->buf,untilbuf) < -rfd->rset->scope )
static int r_read_or (RSFD rfd, void *buf, TERMID *term)
{
- struct rset_multiandor_rfd *mrfd=rfd->priv;
- const struct key_control *kctrl=rfd->rset->keycontrol;
+ struct rset_multiandor_rfd *mrfd = rfd->priv;
+ const struct key_control *kctrl = rfd->rset->keycontrol;
struct heap_item *it;
int rdres;
if (heap_empty(mrfd->h))
it = mrfd->h->heap[1];
memcpy(buf,it->buf, kctrl->key_size);
if (term)
- *term=it->term;
+ *term = it->term;
(mrfd->hits)++;
- rdres=rset_read(it->fd, it->buf, &it->term);
+ rdres = rset_read(it->fd, it->buf, &it->term);
if ( rdres )
heap_balance(mrfd->h);
else
/* Once a hit has been found, scan all items for the smallest */
/* value. Mark all as being in the tail. Read next from that */
/* item, and if not in the same record, clear its tail bit */
- struct rset_multiandor_rfd *p=rfd->priv;
- const struct key_control *kctrl=rfd->rset->keycontrol;
- struct rset_multiandor_info *info=rfd->rset->priv;
+ struct rset_multiandor_rfd *p = rfd->priv;
+ const struct key_control *kctrl = rfd->rset->keycontrol;
+ struct rset_multiandor_info *info = rfd->rset->priv;
int i, mintail;
int cmp;
while (1) {
if (p->tailcount)
{ /* we are tailing, find lowest tail and return it */
- mintail=0;
+ mintail = 0;
while ((mintail<info->no_rsets) && !p->tailbits[mintail])
mintail++; /* first tail */
- for (i=mintail+1;i<info->no_rsets;i++)
+ for (i = mintail+1; i<info->no_rsets; i++)
{
if (p->tailbits[i])
{
cmp=(*kctrl->cmp)(p->items[i].buf,p->items[mintail].buf);
if (cmp<0)
- mintail=i;
+ mintail = i;
}
}
/* return the lowest tail */
memcpy(buf, p->items[mintail].buf, kctrl->key_size);
if (term)
- *term=p->items[mintail].term;
+ *term = p->items[mintail].term;
if (!rset_read(p->items[mintail].fd, p->items[mintail].buf,
&p->items[mintail].term))
{
- p->eof=1; /* game over, once tails have been returned */
+ p->eof = 1; /* game over, once tails have been returned */
p->tailbits[mintail]=0;
(p->tailcount)--;
return 1;
/* as tails. the earlier 'if' will then return the hits */
if (p->eof)
return 0; /* nothing more to see */
- i=1; /* assume items[0] is highest up */
+ i = 1; /* assume items[0] is highest up */
while (i<info->no_rsets) {
cmp=(*kctrl->cmp)(p->items[0].buf,p->items[i].buf);
if (cmp<=-rfd->rset->scope) { /* [0] was behind, forward it */
if (!rset_forward(p->items[0].fd, p->items[0].buf,
&p->items[0].term, p->items[i].buf))
{
- p->eof=1; /* game over */
+ p->eof = 1; /* game over */
return 0;
}
- i=0; /* start frowarding from scratch */
+ i = 0; /* start frowarding from scratch */
} else if (cmp>=rfd->rset->scope)
{ /* [0] was ahead, forward i */
if (!rset_forward(p->items[i].fd, p->items[i].buf,
&p->items[i].term, p->items[0].buf))
{
- p->eof=1; /* game over */
+ p->eof = 1; /* game over */
return 0;
}
} else
/* if we get this far, all rsets are now within +- scope of [0] */
/* ergo, we have a hit. Mark them all as tailing, and let the */
/* upper 'if' return the hits in right order */
- for (i=0; i<info->no_rsets;i++)
- p->tailbits[i]=1;
- p->tailcount=info->no_rsets;
+ for (i = 0; i<info->no_rsets; i++)
+ p->tailbits[i] = 1;
+ p->tailcount = info->no_rsets;
} /* while 1 */
}
static int r_forward_and(RSFD rfd, void *buf, TERMID *term,
const void *untilbuf)
{
- struct rset_multiandor_rfd *p=rfd->priv;
- const struct key_control *kctrl=rfd->rset->keycontrol;
- struct rset_multiandor_info *info=rfd->rset->priv;
+ struct rset_multiandor_rfd *p = rfd->priv;
+ const struct key_control *kctrl = rfd->rset->keycontrol;
+ struct rset_multiandor_info *info = rfd->rset->priv;
int i;
int cmp;
- int killtail=0;
+ int killtail = 0;
- for (i=0; i<info->no_rsets;i++)
+ for (i = 0; i<info->no_rsets; i++)
{
- cmp=(*kctrl->cmp)(p->items[i].buf,untilbuf);
- if ( cmp <= -rfd->rset->scope )
+ cmp = (*kctrl->cmp)(p->items[i].buf,untilbuf);
+ if (cmp <= -rfd->rset->scope)
{
- killtail=1; /* we are moving to a different hit */
+ killtail = 1; /* we are moving to a different hit */
if (!rset_forward(p->items[i].fd, p->items[i].buf,
&p->items[i].term, untilbuf))
{
- p->eof=1; /* game over */
- p->tailcount=0;
+ p->eof = 1; /* game over */
+ p->tailcount = 0;
return 0;
}
}
}
if (killtail)
{
- for (i=0; i<info->no_rsets;i++)
- p->tailbits[i]=0;
- p->tailcount=0;
+ for (i = 0; i<info->no_rsets; i++)
+ p->tailbits[i] = 0;
+ p->tailcount = 0;
}
return r_read_and(rfd,buf,term);
}
static void r_pos (RSFD rfd, double *current, double *total)
{
- struct rset_multiandor_info *info=
- (struct rset_multiandor_info *)(rfd->rset->priv);
- struct rset_multiandor_rfd *mrfd=(struct rset_multiandor_rfd *)(rfd->priv);
+ struct rset_multiandor_info *info =
+ (struct rset_multiandor_info *)(rfd->rset->priv);
+ struct rset_multiandor_rfd *mrfd =
+ (struct rset_multiandor_rfd *)(rfd->priv);
double cur, tot;
- double scur=0.0, stot=0.0;
+ double scur = 0.0, stot = 0.0;
int i;
- for (i=0; i<info->no_rsets; i++){
+ for (i = 0; i<info->no_rsets; i++){
rset_pos(mrfd->items[i].fd, &cur, &tot);
yaz_log(log_level, "r_pos: %d %0.1f %0.1f", i, cur,tot);
scur += cur;
stot += tot;
}
- if (stot <1.0) { /* nothing there */
- *current=0;
- *total=0;
+ if (stot < 1.0) { /* nothing there */
+ *current = 0;
+ *total = 0;
yaz_log(log_level, "r_pos: NULL %0.1f %0.1f", *current, *total);
- return;
}
- *current=mrfd->hits;
- *total=*current*stot/scur;
- yaz_log(log_level, "r_pos: = %0.1f %0.1f", *current, *total);
+ else
+ {
+ *current = mrfd->hits;
+ *total = *current*stot/scur;
+ yaz_log(log_level, "r_pos: = %0.1f %0.1f", *current, *total);
+ }
}
-
-
static int r_write (RSFD rfd, const void *buf)
{
yaz_log (YLOG_FATAL, "multior set type is read-only");
(struct rset_multiandor_info *) ct->priv;
int firstterm= *curterm;
int i;
- for (i=0;i<info->no_rsets;i++)
+ for (i = 0; i<info->no_rsets; i++)
{
rset_getterms(info->rsets[i], terms, maxterms, curterm);
- if ( ( (*curterm) > firstterm+1 ) &&
- ( (*curterm) <= maxterms ) &&
- ( terms[(*curterm)-1] == terms[firstterm] ) )
+ if ( ( *curterm > firstterm+1 ) &&
+ ( *curterm <= maxterms ) &&
+ ( terms[(*curterm)-1] == terms[firstterm] )
+ )
(*curterm)--; /* forget the term, seen that before */
}
}