-/* $Id: rsbetween.c,v 1.40 2005-06-06 21:31:08 adam Exp $
- Copyright (C) 1995-2005
- Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+ Copyright (C) Index Data
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-along with Zebra; see the file LICENSE.zebra. If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
*/
/* rsbetween is (mostly) used for xml searches. It returns the hits of the
* "middle" rset, that are in between the "left" and "right" rsets. For
*/
/* rsbetween is (mostly) used for xml searches. It returns the hits of the
* "middle" rset, that are in between the "left" and "right" rsets. For
* 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
* indexed to the same seqno as the tags).
*
* 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
* indexed to the same seqno as the tags).
*
static RSFD r_open(RSET ct, int flag);
static void r_close(RSFD rfd);
static void r_delete(RSET ct);
static RSFD r_open(RSET ct, int flag);
static void r_close(RSFD rfd);
static void r_delete(RSET ct);
TERMID *term, const void *untilbuf);
static int r_read(RSFD rfd, void *buf, TERMID *term );
TERMID *term, const void *untilbuf);
static int r_read(RSFD rfd, void *buf, TERMID *term );
static void r_pos(RSFD rfd, double *current, double *total);
static void r_get_terms(RSET ct, TERMID *terms, int maxterms, int *curterm);
static void r_pos(RSFD rfd, double *current, double *total);
static void r_get_terms(RSET ct, TERMID *terms, int maxterms, int *curterm);
int depth; /* number of start-tags without end-tags */
int attrdepth; /* on what depth the attr matched */
zint hits;
int depth; /* number of start-tags without end-tags */
int attrdepth; /* on what depth the attr matched */
zint hits;
- rs->term = rset_term_create(tag, strlen(tag), "", 0, nmem, 0);
+ rs->term = rset_term_create(tag, -1, "", 0, nmem, 0, 0, 0, 0);
-RSET rsbetween_create(NMEM nmem, struct rset_key_control *kcontrol,
- int scope,
- RSET rset_l, RSET rset_m, RSET rset_r, RSET rset_attr)
+RSET rset_create_between(NMEM nmem, struct rset_key_control *kcontrol,
+ int scope,
+ RSET rset_l, RSET rset_m, RSET rset_r, RSET rset_attr)
{
RSET rnew = rset_create_base(&control, nmem, kcontrol, scope, 0, 0, 0);
struct rset_between_info *info=
(struct rset_between_info *) nmem_malloc(rnew->nmem,sizeof(*info));
RSET rsetarray[4];
int n = 4;
{
RSET rnew = rset_create_base(&control, nmem, kcontrol, scope, 0, 0, 0);
struct rset_between_info *info=
(struct rset_between_info *) nmem_malloc(rnew->nmem,sizeof(*info));
RSET rsetarray[4];
int n = 4;
p=(struct rset_between_rfd *)rfd->priv;
else {
p = (struct rset_between_rfd *) nmem_malloc(ct->nmem, (sizeof(*p)));
rfd->priv = p;
p=(struct rset_between_rfd *)rfd->priv;
else {
p = (struct rset_between_rfd *) nmem_malloc(ct->nmem, (sizeof(*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->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);
TERMID *term, const void *untilbuf)
{
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
TERMID *term, const void *untilbuf)
{
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
{
yaz_log(log_level,"read loop term=%p d=%d ad=%d",
*term, p->depth, p->attrdepth);
{
yaz_log(log_level,"read loop term=%p d=%d ad=%d",
*term, p->depth, p->attrdepth);
p->hits, p->depth, p->attrdepth);
return 1; /* we have everything in place already! */
} else
p->hits, p->depth, p->attrdepth);
return 1; /* we have everything in place already! */
} else
static void r_pos(RSFD rfd, double *current, double *total)
{
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
static void r_pos(RSFD rfd, double *current, double *total)
{
struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv;
rset_getterms(ct->children[0], terms, maxterms, curterm);
}
rset_getterms(ct->children[0], terms, maxterms, curterm);
}