2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.15 1996-10-29 13:55:22 adam
8 * Include of zebrautl.h instead of alexutil.h.
10 * Revision 1.14 1995/12/11 09:15:24 adam
11 * New set types: sand/sor/snot - ranked versions of and/or/not in
12 * ranked/semi-ranked result sets.
13 * Note: the snot not finished yet.
14 * New rset member: flag.
15 * Bug fix: r_delete in rsrel.c did free bad memory block.
17 * Revision 1.13 1995/10/12 12:41:56 adam
18 * Private info (buf) moved from struct rset_control to struct rset.
19 * Bug fixes in relevance.
21 * Revision 1.12 1995/10/10 14:00:04 adam
22 * Function rset_open changed its wflag parameter to general flags.
24 * Revision 1.11 1995/10/06 14:38:05 adam
25 * New result set method: r_score.
26 * Local no (sysno) and score is transferred to retrieveCtrl.
28 * Revision 1.10 1995/09/08 14:52:42 adam
29 * Work on relevance feedback.
31 * Revision 1.9 1995/09/07 13:58:43 adam
32 * New parameter: result-set file descriptor (RSFD) to support multiple
33 * positions within the same result-set.
34 * Boolean operators: and, or, not implemented.
36 * Revision 1.8 1995/09/06 16:11:56 adam
37 * More work on boolean sets.
39 * Revision 1.7 1995/09/06 10:35:44 adam
40 * Null set implemented.
42 * Revision 1.6 1995/09/05 11:43:24 adam
43 * Complete version of temporary sets. Not tested yet though.
45 * Revision 1.5 1995/09/04 12:33:56 adam
46 * Various cleanup. YAZ util used instead.
48 * Revision 1.4 1995/09/04 09:10:55 adam
51 * Revision 1.3 1994/11/22 13:15:37 quinn
54 * Revision 1.2 1994/11/04 14:53:12 quinn
64 static void *r_create(const struct rset_control *sel, void *parms,
66 static RSFD r_open (RSET ct, int flag);
67 static void r_close (RSFD rfd);
68 static void r_delete (RSET ct);
69 static void r_rewind (RSFD rfd);
70 static int r_count (RSET ct);
71 static int r_read (RSFD rfd, void *buf);
72 static int r_write (RSFD rfd, const void *buf);
73 static int r_score (RSFD rfd, int *score);
75 static const rset_control control =
89 const rset_control *rset_kind_isam = &control;
91 struct rset_ispt_info {
93 struct rset_ispt_info *next;
94 struct rset_isam_info *info;
97 struct rset_isam_info {
100 struct rset_ispt_info *ispt_list;
103 static void *r_create(const struct rset_control *sel, void *parms,
106 rset_isam_parms *pt = parms;
107 struct rset_isam_info *info;
109 *flags |= RSET_FLAG_VOLATILE;
110 info = xmalloc (sizeof(struct rset_isam_info));
113 info->ispt_list = NULL;
117 RSFD r_open (RSET ct, int flag)
119 struct rset_isam_info *info = ct->buf;
120 struct rset_ispt_info *ptinfo;
122 logf (LOG_DEBUG, "risam_open");
123 if (flag & RSETF_WRITE)
125 logf (LOG_FATAL, "ISAM set type is read-only");
128 ptinfo = xmalloc (sizeof(*ptinfo));
129 ptinfo->next = info->ispt_list;
130 info->ispt_list = ptinfo;
131 ptinfo->pt = is_position (info->is, info->pos);
136 static void r_close (RSFD rfd)
138 struct rset_isam_info *info = ((struct rset_ispt_info*) rfd)->info;
139 struct rset_ispt_info **ptinfop;
141 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
144 is_pt_free ((*ptinfop)->pt);
145 *ptinfop = (*ptinfop)->next;
149 logf (LOG_FATAL, "r_close but no rfd match!");
153 static void r_delete (RSET ct)
155 struct rset_isam_info *info = ct->buf;
157 logf (LOG_DEBUG, "rsisam_delete");
158 assert (info->ispt_list == NULL);
162 static void r_rewind (RSFD rfd)
164 logf (LOG_DEBUG, "rsisam_rewind");
165 is_rewind( ((struct rset_ispt_info*) rfd)->pt);
168 static int r_count (RSET ct)
173 static int r_read (RSFD rfd, void *buf)
175 return is_readkey( ((struct rset_ispt_info*) rfd)->pt, buf);
178 static int r_write (RSFD rfd, const void *buf)
180 logf (LOG_FATAL, "ISAM set type is read-only");
184 static int r_score (RSFD rfd, int *score)