2 * Copyright (C) 1994-1996, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1997-12-18 10:54:25 adam
8 * New method result set method rs_hits that returns the number of
9 * hits in result-set (if known). The ranked result set returns real
10 * number of hits but only when not combined with other operands.
12 * Revision 1.3 1997/10/31 12:37:01 adam
13 * Code calls xfree() instead of free().
15 * Revision 1.2 1996/11/08 11:15:57 adam
16 * Compressed isam fully supported.
18 * Revision 1.1 1996/10/29 13:41:48 adam
28 static void *r_create(const struct rset_control *sel, void *parms,
30 static RSFD r_open (RSET ct, int flag);
31 static void r_close (RSFD rfd);
32 static void r_delete (RSET ct);
33 static void r_rewind (RSFD rfd);
34 static int r_count (RSET ct);
35 static int r_hits (RSET ct, void *oi);
36 static int r_read (RSFD rfd, void *buf);
37 static int r_write (RSFD rfd, const void *buf);
38 static int r_score (RSFD rfd, int *score);
40 static const rset_control control =
55 const rset_control *rset_kind_isamc = &control;
59 struct rset_pp_info *next;
60 struct rset_isamc_info *info;
63 struct rset_isamc_info {
66 struct rset_pp_info *ispt_list;
69 static void *r_create(const struct rset_control *sel, void *parms,
72 rset_isamc_parms *pt = parms;
73 struct rset_isamc_info *info;
75 *flags |= RSET_FLAG_VOLATILE;
76 info = xmalloc (sizeof(*info));
79 info->ispt_list = NULL;
83 RSFD r_open (RSET ct, int flag)
85 struct rset_isamc_info *info = ct->buf;
86 struct rset_pp_info *ptinfo;
88 logf (LOG_DEBUG, "risamc_open");
89 if (flag & RSETF_WRITE)
91 logf (LOG_FATAL, "ISAMC set type is read-only");
94 ptinfo = xmalloc (sizeof(*ptinfo));
95 ptinfo->next = info->ispt_list;
96 info->ispt_list = ptinfo;
97 ptinfo->pt = isc_pp_open (info->is, info->pos);
102 static void r_close (RSFD rfd)
104 struct rset_isamc_info *info = ((struct rset_pp_info*) rfd)->info;
105 struct rset_pp_info **ptinfop;
107 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
110 isc_pp_close ((*ptinfop)->pt);
111 *ptinfop = (*ptinfop)->next;
115 logf (LOG_FATAL, "r_close but no rfd match!");
119 static void r_delete (RSET ct)
121 struct rset_isamc_info *info = ct->buf;
123 logf (LOG_DEBUG, "rsisamc_delete");
124 assert (info->ispt_list == NULL);
128 static void r_rewind (RSFD rfd)
130 logf (LOG_DEBUG, "rsisamc_rewind");
134 static int r_count (RSET ct)
139 static int r_hits (RSET ct, void *oi)
144 static int r_read (RSFD rfd, void *buf)
146 return isc_pp_read( ((struct rset_pp_info*) rfd)->pt, buf);
149 static int r_write (RSFD rfd, const void *buf)
151 logf (LOG_FATAL, "ISAMC set type is read-only");
155 static int r_score (RSFD rfd, int *score)