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