2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.7 1995-10-06 14:38:01 adam
8 * New result set method: r_score.
9 * Local no (sysno) and score is transferred to retrieveCtrl.
11 * Revision 1.6 1995/09/28 09:19:49 adam
12 * xfree/xmalloc used everywhere.
13 * Extract/retrieve method seems to work for text records.
15 * Revision 1.5 1995/09/27 16:17:32 adam
16 * More work on retrieve.
18 * Revision 1.4 1995/09/07 13:58:36 adam
19 * New parameter: result-set file descriptor (RSFD) to support multiple
20 * positions within the same result-set.
21 * Boolean operators: and, or, not implemented.
22 * Result-set references.
24 * Revision 1.3 1995/09/06 16:11:19 adam
25 * Option: only one word key per file.
27 * Revision 1.2 1995/09/06 10:33:04 adam
28 * More work on present. Some log messages removed.
30 * Revision 1.1 1995/09/05 15:28:40 adam
31 * More work on search engine.
41 ZServerSet *resultSetAdd (ZServerInfo *zi, const char *name, int ov, RSET rset)
45 for (s = zi->sets; s; s = s->next)
46 if (!strcmp (s->name, name))
50 rset_delete (s->rset);
54 s = xmalloc (sizeof(*s));
57 s->name = xmalloc (strlen(name)+1);
58 strcpy (s->name, name);
63 ZServerSet *resultSetGet (ZServerInfo *zi, const char *name)
67 for (s = zi->sets; s; s = s->next)
68 if (!strcmp (s->name, name))
73 ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name,
74 int num, int *positions)
85 if (!(sset = resultSetGet (zi, name)))
87 if (!(rset = sset->rset))
89 logf (LOG_DEBUG, "resultSetRecordGet");
90 sr = xmalloc (sizeof(*sr) * num);
91 rfd = rset_open (rset, 0);
92 while (rset_read (rset, rfd, &key))
94 if (key.sysno != psysno)
98 if (position == positions[num_i])
100 sr[num_i].sysno = psysno;
101 rset_score (rset, rfd, &sr[num_i].score);
108 rset_close (rset, rfd);
117 void resultSetRecordDel (ZServerInfo *zi, ZServerRecord *records, int num)
121 for (i = 0; i<num; i++)
122 xfree (records[i].buf);