46 TERMID *term,
const void *untilbuf);
48 static void r_pos(
RSFD rfd,
double *current,
double *total);
113 log_level = yaz_log_module_level(
"rsbetween");
116 rsetarray[n++] = rset_l;
120 rsetarray[n++] = rset_r;
124 rsetarray[n++] = rset_m1;
127 rsetarray[n++] = rset_m2;
144 rsetarray[n++] = rset_attr;
153 scope, n, rsetarray);
155 yaz_log(
log_level,
"create rset at %p", rnew);
171 yaz_log(YLOG_FATAL,
"between set type is read-only");
190 yaz_log(
log_level,
"open rset=%p rfd=%p", ct, rfd);
202 TERMID *term,
const void *untilbuf)
225 if ( p->startbufok && p->attrbufok )
227 cmp = (kctrl->
cmp)(p->startbuf, p->attrbuf);
230 p->attrdepth = p->depth;
231 yaz_log(
log_level,
"found attribute match at depth %d",
245 yaz_log(
log_level,
"== read: term=%p",term);
250 yaz_log(
log_level,
"read loop term=%p d=%d ad=%d",
251 *term, p->depth, p->attrdepth);
254 memcpy(p->recbuf, buf, kctrl->
key_size);
259 cmp = (kctrl->
cmp)(buf, p->recbuf);
268 p->match_1 = p->match_2 = 0;
269 memcpy(p->recbuf, buf, kctrl->
key_size);
273 yaz_log(
log_level,
" term: '%s'", (*term)->name);
277 yaz_log(
log_level,
"read start tag. d=%d", p->depth);
278 memcpy(p->startbuf, buf, kctrl->
key_size);
284 if (p->depth == p->attrdepth)
288 p->match_1 = p->match_2 = 0;
289 yaz_log(
log_level,
"read end tag. d=%d ad=%d", p->depth,
295 memcpy(p->attrbuf, buf, kctrl->
key_size);
301 if (p->depth && p->attrdepth)
304 p->match_1 = p->match_2 = 1;
316 if (p->match_1 && p->match_2)
320 p->hits, p->depth, p->attrdepth);
325 p->hits, p->depth, p->attrdepth);
331 static void r_pos(
RSFD rfd,
double *current,
double *total)
335 yaz_log(
log_level,
"pos: %0.1f/%0.1f ", *current, *total);
static const struct rset_control control
static int r_read(RSFD rfd, void *buf, TERMID *term)
static void checkattr(RSFD rfd)
static void r_get_terms(RSET ct, TERMID *terms, int maxterms, int *curterm)
static void r_delete(RSET ct)
RSET rset_create_between(NMEM nmem, struct rset_key_control *kcontrol, int scope, RSET rset_l, RSET rset_m1, RSET rset_m2, RSET rset_r, RSET rset_attr)
static int r_forward(RSFD rfd, void *buf, TERMID *term, const void *untilbuf)
static void r_pos(RSFD rfd, double *current, double *total)
static int log_level_initialized
static void checkterm(RSET rs, char *tag, NMEM nmem)
static RSFD r_open(RSET ct, int flag)
static void r_close(RSFD rfd)
RSET rset_create_base(const struct rset_control *sel, NMEM nmem, struct rset_key_control *kcontrol, int scope, TERMID term, int no_children, RSET *children)
Common constuctor for RSETs.
RSET rset_create_and(NMEM nmem, struct rset_key_control *kcontrol, int scope, int no_rsets, RSET *rsets)
#define rset_read(rfd, buf, term)
struct rset_term * TERMID
int rset_no_write(RSFD rfd, const void *buf)
RSFD rfd_create_base(RSET rs)
Common constuctor for RFDs.
TERMID rset_term_create(const char *name, int length, const char *flags, int type, NMEM nmem, struct ord_list *ol, int reg_type, zint hits_limit, const char *ref_id)
Creates a TERMID entry.
#define rset_getterms(ct, terms, maxterms, curterm)
#define rset_pos(rfd, cur, tot)
#define rset_open(rs, wflag)
void rset_close(RSFD rfd)
Closes a result set RFD handle.
#define rset_forward(rfd, buf, term, untilbuf)
int(* cmp)(const void *p1, const void *p2)
struct rset_key_control * keycontrol