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