Work on truncation.
[idzebra-moved-to-github.git] / index / zserver.h
1 /*
2  * Copyright (C) 1994-1996, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: zserver.h,v $
7  * Revision 1.23  1996-12-23 15:30:46  adam
8  * Work on truncation.
9  * Bug fix: result sets weren't deleted after server shut down.
10  *
11  * Revision 1.22  1996/11/04 14:07:49  adam
12  * Moved truncation code to trunc.c.
13  *
14  * Revision 1.21  1996/10/29 14:09:58  adam
15  * Use of cisam system - enabled if setting isamc is 1.
16  *
17  * Revision 1.20  1996/06/04 10:19:02  adam
18  * Minor changes - removed include of ctype.h.
19  *
20  * Revision 1.19  1996/05/14  11:34:01  adam
21  * Scan support in multiple registers/databases.
22  *
23  * Revision 1.18  1996/05/14  06:16:50  adam
24  * Compact use/set bytes used in search service.
25  *
26  * Revision 1.17  1995/12/08 16:22:57  adam
27  * Work on update while servers are running. Three lock files introduced.
28  * The servers reload their registers when necessary, but they don't
29  * reestablish result sets yet.
30  *
31  * Revision 1.16  1995/12/07  17:38:48  adam
32  * Work locking mechanisms for concurrent updates/commit.
33  *
34  * Revision 1.15  1995/11/21  15:29:13  adam
35  * Config file 'base' read by default by both indexer and server.
36  *
37  * Revision 1.14  1995/11/16  17:00:57  adam
38  * Better logging of rpn query.
39  *
40  * Revision 1.13  1995/11/16  15:34:56  adam
41  * Uses new record management system in both indexer and server.
42  *
43  * Revision 1.12  1995/10/27  14:00:12  adam
44  * Implemented detection of database availability.
45  *
46  * Revision 1.11  1995/10/17  18:02:12  adam
47  * New feature: databases. Implemented as prefix to words in dictionary.
48  *
49  * Revision 1.10  1995/10/09  16:18:38  adam
50  * Function dict_lookup_grep got extra client data parameter.
51  *
52  * Revision 1.9  1995/10/06  14:38:01  adam
53  * New result set method: r_score.
54  * Local no (sysno) and score is transferred to retrieveCtrl.
55  *
56  * Revision 1.8  1995/10/06  13:52:06  adam
57  * Bug fixes. Handler may abort further scanning.
58  *
59  * Revision 1.7  1995/10/06  10:43:57  adam
60  * Scan added. 'occurrences' in scan entries not set yet.
61  *
62  * Revision 1.6  1995/09/28  09:19:48  adam
63  * xfree/xmalloc used everywhere.
64  * Extract/retrieve method seems to work for text records.
65  *
66  * Revision 1.5  1995/09/27  16:17:32  adam
67  * More work on retrieve.
68  *
69  * Revision 1.4  1995/09/14  11:53:28  adam
70  * First work on regular expressions/truncations.
71  *
72  * Revision 1.3  1995/09/08  08:53:23  adam
73  * Record buffer maintained in server_info.
74  *
75  * Revision 1.2  1995/09/06  16:11:19  adam
76  * Option: only one word key per file.
77  *
78  * Revision 1.1  1995/09/05  15:28:40  adam
79  * More work on search engine.
80  *
81  */
82
83 #include <backend.h>
84 #include <rset.h>
85
86 #include "index.h"
87 #include "zinfo.h"
88
89 typedef struct {
90     int sysno;
91     int score;
92 } ZServerSetSysno;
93
94 typedef struct ZServerSet_ {
95     char *name;
96     RSET rset;
97     int size;
98     struct ZServerSet_ *next;
99 } ZServerSet;
100    
101 typedef struct {
102     int registerState; /* 0 (no commit pages), 1 (use commit pages) */
103     time_t registerChange;
104     ZServerSet *sets;
105     Dict dict;
106     ISAM isam;
107     ISAMC isamc;
108     Records records;
109     int errCode;
110     char *errString;
111     ODR odr;
112     ZebTargetInfo *zti;
113 } ZServerInfo;
114
115 int rpn_search (ZServerInfo *zi, 
116                 Z_RPNQuery *rpn, int num_bases, char **basenames, 
117                 const char *setname, int *hits);
118
119 int rpn_scan (ZServerInfo *zi, Z_AttributesPlusTerm *zapt,
120               oid_value attributeset,
121               int num_bases, char **basenames,
122               int *position, int *num_entries, struct scan_entry **list,
123               int *status);
124
125 RSET rset_trunc (ZServerInfo *zi, ISAM_P *isam_p, int no);
126
127 ZServerSet *resultSetAdd (ZServerInfo *zi, const char *name,
128                           int ov, RSET rset);
129 ZServerSet *resultSetGet (ZServerInfo *zi, const char *name);
130 void resultSetDestroy (ZServerInfo *zi);
131
132 ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name,
133                                     int num, int *positions);
134 void resultSetSysnoDel (ZServerInfo *zi, ZServerSetSysno *records, int num);
135 void zlog_rpn (Z_RPNQuery *rpn);
136
137 int zebraServerLock (int lockCommit);
138 void zebraServerUnlock (int commitPhase);
139 int zebraServerLockGetState (time_t *timep);