Uses new record management system in both indexer and server.
[idzebra-moved-to-github.git] / index / zserver.h
1 /*
2  * Copyright (C) 1994-1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: zserver.h,v $
7  * Revision 1.13  1995-11-16 15:34:56  adam
8  * Uses new record management system in both indexer and server.
9  *
10  * Revision 1.12  1995/10/27  14:00:12  adam
11  * Implemented detection of database availability.
12  *
13  * Revision 1.11  1995/10/17  18:02:12  adam
14  * New feature: databases. Implemented as prefix to words in dictionary.
15  *
16  * Revision 1.10  1995/10/09  16:18:38  adam
17  * Function dict_lookup_grep got extra client data parameter.
18  *
19  * Revision 1.9  1995/10/06  14:38:01  adam
20  * New result set method: r_score.
21  * Local no (sysno) and score is transferred to retrieveCtrl.
22  *
23  * Revision 1.8  1995/10/06  13:52:06  adam
24  * Bug fixes. Handler may abort further scanning.
25  *
26  * Revision 1.7  1995/10/06  10:43:57  adam
27  * Scan added. 'occurrences' in scan entries not set yet.
28  *
29  * Revision 1.6  1995/09/28  09:19:48  adam
30  * xfree/xmalloc used everywhere.
31  * Extract/retrieve method seems to work for text records.
32  *
33  * Revision 1.5  1995/09/27  16:17:32  adam
34  * More work on retrieve.
35  *
36  * Revision 1.4  1995/09/14  11:53:28  adam
37  * First work on regular expressions/truncations.
38  *
39  * Revision 1.3  1995/09/08  08:53:23  adam
40  * Record buffer maintained in server_info.
41  *
42  * Revision 1.2  1995/09/06  16:11:19  adam
43  * Option: only one word key per file.
44  *
45  * Revision 1.1  1995/09/05  15:28:40  adam
46  * More work on search engine.
47  *
48  */
49
50 #include <backend.h>
51 #include <rset.h>
52
53 #include "index.h"
54 #if RECORD_BASE
55 #include "recindex.h"
56 #endif
57
58 typedef struct {
59     int sysno;
60     int score;
61 } ZServerSetSysno;
62
63 typedef struct ZServerSet_ {
64     char *name;
65     RSET rset;
66     int size;
67     struct ZServerSet_ *next;
68 } ZServerSet;
69    
70 typedef struct {
71     ZServerSet *sets;
72     Dict wordDict;
73     ISAM wordIsam;
74     Dict fileDict;
75 #if RECORD_BASE
76     Records records;
77 #else
78     int sys_idx_fd;
79 #endif
80     int errCode;
81     char *errString;
82     ODR odr;
83 } ZServerInfo;
84
85 int rpn_search (ZServerInfo *zi, 
86                 Z_RPNQuery *rpn, int num_bases, char **basenames, 
87                 const char *setname, int *hits);
88
89 int rpn_scan (ZServerInfo *zi, Z_AttributesPlusTerm *zapt,
90               int num_bases, char **basenames,
91               int *position, int *num_entries, struct scan_entry **list,
92               int *status);
93
94 ZServerSet *resultSetAdd (ZServerInfo *zi, const char *name,
95                           int ov, RSET rset);
96 ZServerSet *resultSetGet (ZServerInfo *zi, const char *name);
97 ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name,
98                                     int num, int *positions);
99 void resultSetSysnoDel (ZServerInfo *zi, ZServerSetSysno *records, int num);