2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.8 1995-10-10 13:59:25 adam
8 * Function rset_open changed its wflag parameter to general flags.
10 * Revision 1.7 1995/10/06 14:38:01 adam
11 * New result set method: r_score.
12 * Local no (sysno) and score is transferred to retrieveCtrl.
14 * Revision 1.6 1995/09/28 09:19:49 adam
15 * xfree/xmalloc used everywhere.
16 * Extract/retrieve method seems to work for text records.
18 * Revision 1.5 1995/09/27 16:17:32 adam
19 * More work on retrieve.
21 * Revision 1.4 1995/09/07 13:58:36 adam
22 * New parameter: result-set file descriptor (RSFD) to support multiple
23 * positions within the same result-set.
24 * Boolean operators: and, or, not implemented.
25 * Result-set references.
27 * Revision 1.3 1995/09/06 16:11:19 adam
28 * Option: only one word key per file.
30 * Revision 1.2 1995/09/06 10:33:04 adam
31 * More work on present. Some log messages removed.
33 * Revision 1.1 1995/09/05 15:28:40 adam
34 * More work on search engine.
44 ZServerSet *resultSetAdd (ZServerInfo *zi, const char *name, int ov, RSET rset)
48 for (s = zi->sets; s; s = s->next)
49 if (!strcmp (s->name, name))
53 rset_delete (s->rset);
57 s = xmalloc (sizeof(*s));
60 s->name = xmalloc (strlen(name)+1);
61 strcpy (s->name, name);
66 ZServerSet *resultSetGet (ZServerInfo *zi, const char *name)
70 for (s = zi->sets; s; s = s->next)
71 if (!strcmp (s->name, name))
76 ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name,
77 int num, int *positions)
88 if (!(sset = resultSetGet (zi, name)))
90 if (!(rset = sset->rset))
92 logf (LOG_DEBUG, "resultSetRecordGet");
93 sr = xmalloc (sizeof(*sr) * num);
94 rfd = rset_open (rset, RSETF_READ|RSETF_SORT_RANK);
95 while (rset_read (rset, rfd, &key))
97 if (key.sysno != psysno)
101 if (position == positions[num_i])
103 sr[num_i].sysno = psysno;
104 rset_score (rset, rfd, &sr[num_i].score);
111 rset_close (rset, rfd);
120 void resultSetRecordDel (ZServerInfo *zi, ZServerRecord *records, int num)
124 for (i = 0; i<num; i++)
125 xfree (records[i].buf);