2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.9 1995-10-17 18:02:14 adam
8 * New feature: databases. Implemented as prefix to words in dictionary.
10 * Revision 1.8 1995/10/10 13:59:25 adam
11 * Function rset_open changed its wflag parameter to general flags.
13 * Revision 1.7 1995/10/06 14:38:01 adam
14 * New result set method: r_score.
15 * Local no (sysno) and score is transferred to retrieveCtrl.
17 * Revision 1.6 1995/09/28 09:19:49 adam
18 * xfree/xmalloc used everywhere.
19 * Extract/retrieve method seems to work for text records.
21 * Revision 1.5 1995/09/27 16:17:32 adam
22 * More work on retrieve.
24 * Revision 1.4 1995/09/07 13:58:36 adam
25 * New parameter: result-set file descriptor (RSFD) to support multiple
26 * positions within the same result-set.
27 * Boolean operators: and, or, not implemented.
28 * Result-set references.
30 * Revision 1.3 1995/09/06 16:11:19 adam
31 * Option: only one word key per file.
33 * Revision 1.2 1995/09/06 10:33:04 adam
34 * More work on present. Some log messages removed.
36 * Revision 1.1 1995/09/05 15:28:40 adam
37 * More work on search engine.
47 ZServerSet *resultSetAdd (ZServerInfo *zi, const char *name, int ov, RSET rset)
51 for (s = zi->sets; s; s = s->next)
52 if (!strcmp (s->name, name))
56 rset_delete (s->rset);
60 s = xmalloc (sizeof(*s));
63 s->name = xmalloc (strlen(name)+1);
64 strcpy (s->name, name);
69 ZServerSet *resultSetGet (ZServerInfo *zi, const char *name)
73 for (s = zi->sets; s; s = s->next)
74 if (!strcmp (s->name, name))
79 ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name,
80 int num, int *positions)
91 if (!(sset = resultSetGet (zi, name)))
93 if (!(rset = sset->rset))
95 logf (LOG_DEBUG, "resultSetRecordGet");
96 sr = xmalloc (sizeof(*sr) * num);
97 rfd = rset_open (rset, RSETF_READ|RSETF_SORT_RANK);
98 while (rset_read (rset, rfd, &key))
100 if (key.sysno != psysno)
104 if (position == positions[num_i])
106 sr[num_i].sysno = psysno;
107 rset_score (rset, rfd, &sr[num_i].score);
114 rset_close (rset, rfd);
123 void resultSetSysnoDel (ZServerInfo *zi, ZServerSetSysno *records, int num)