2 * Copyright (C) 1994-1998, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.29 1998-02-10 12:03:06 adam
10 * Revision 1.28 1998/01/29 13:40:11 adam
11 * Better logging for scan service.
13 * Revision 1.27 1997/10/27 14:33:06 adam
14 * Moved towards generic character mapping depending on "structure"
15 * field in abstract syntax file. Fixed a few memory leaks. Fixed
16 * bug with negative integers when doing searches with relational
19 * Revision 1.26 1997/09/29 12:41:35 adam
20 * Fixed bug regarding USE_TIMES var.
22 * Revision 1.25 1997/09/29 09:08:36 adam
23 * Revised locking system to be thread safe for the server.
25 * Revision 1.24 1997/09/17 12:19:19 adam
26 * Zebra version corresponds to YAZ version 1.4.
27 * Changed Zebra server so that it doesn't depend on global common_resource.
29 * Revision 1.23 1996/12/23 15:30:46 adam
31 * Bug fix: result sets weren't deleted after server shut down.
33 * Revision 1.22 1996/11/04 14:07:49 adam
34 * Moved truncation code to trunc.c.
36 * Revision 1.21 1996/10/29 14:09:58 adam
37 * Use of cisam system - enabled if setting isamc is 1.
39 * Revision 1.20 1996/06/04 10:19:02 adam
40 * Minor changes - removed include of ctype.h.
42 * Revision 1.19 1996/05/14 11:34:01 adam
43 * Scan support in multiple registers/databases.
45 * Revision 1.18 1996/05/14 06:16:50 adam
46 * Compact use/set bytes used in search service.
48 * Revision 1.17 1995/12/08 16:22:57 adam
49 * Work on update while servers are running. Three lock files introduced.
50 * The servers reload their registers when necessary, but they don't
51 * reestablish result sets yet.
53 * Revision 1.16 1995/12/07 17:38:48 adam
54 * Work locking mechanisms for concurrent updates/commit.
56 * Revision 1.15 1995/11/21 15:29:13 adam
57 * Config file 'base' read by default by both indexer and server.
59 * Revision 1.14 1995/11/16 17:00:57 adam
60 * Better logging of rpn query.
62 * Revision 1.13 1995/11/16 15:34:56 adam
63 * Uses new record management system in both indexer and server.
65 * Revision 1.12 1995/10/27 14:00:12 adam
66 * Implemented detection of database availability.
68 * Revision 1.11 1995/10/17 18:02:12 adam
69 * New feature: databases. Implemented as prefix to words in dictionary.
71 * Revision 1.10 1995/10/09 16:18:38 adam
72 * Function dict_lookup_grep got extra client data parameter.
74 * Revision 1.9 1995/10/06 14:38:01 adam
75 * New result set method: r_score.
76 * Local no (sysno) and score is transferred to retrieveCtrl.
78 * Revision 1.8 1995/10/06 13:52:06 adam
79 * Bug fixes. Handler may abort further scanning.
81 * Revision 1.7 1995/10/06 10:43:57 adam
82 * Scan added. 'occurrences' in scan entries not set yet.
84 * Revision 1.6 1995/09/28 09:19:48 adam
85 * xfree/xmalloc used everywhere.
86 * Extract/retrieve method seems to work for text records.
88 * Revision 1.5 1995/09/27 16:17:32 adam
89 * More work on retrieve.
91 * Revision 1.4 1995/09/14 11:53:28 adam
92 * First work on regular expressions/truncations.
94 * Revision 1.3 1995/09/08 08:53:23 adam
95 * Record buffer maintained in server_info.
97 * Revision 1.2 1995/09/06 16:11:19 adam
98 * Option: only one word key per file.
100 * Revision 1.1 1995/09/05 15:28:40 adam
101 * More work on search engine.
115 #include <sys/times.h>
130 typedef struct ZServerSet_ {
134 struct zset_sort_info *sort_info;
135 struct ZServerSet_ *next;
139 int registerState; /* 0 (no commit pages), 1 (use commit pages) */
140 time_t registerChange;
151 data1_attset *registered_sets;
155 ZebraLockHandle server_lock_cmt;
156 ZebraLockHandle server_lock_org;
157 char *server_path_prefix;
162 ZebraMaps zebra_maps;
165 int rpn_search (ZServerInfo *zi, ODR stream,
166 Z_RPNQuery *rpn, int num_bases, char **basenames,
167 const char *setname, int *hits);
169 int rpn_scan (ZServerInfo *zi, ODR stream, Z_AttributesPlusTerm *zapt,
170 oid_value attributeset,
171 int num_bases, char **basenames,
172 int *position, int *num_entries, struct scan_entry **list,
175 RSET rset_trunc (ZServerInfo *zi, ISAM_P *isam_p, int no);
177 ZServerSet *resultSetAdd (ZServerInfo *zi, const char *name,
179 ZServerSet *resultSetGet (ZServerInfo *zi, const char *name);
180 void resultSetDestroy (ZServerInfo *zi);
182 ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name,
183 int num, int *positions);
184 void resultSetSysnoDel (ZServerInfo *zi, ZServerSetSysno *records, int num);
186 int resultSetSort (ZServerInfo *zi, bend_sort_rr *rr);
188 void zlog_rpn (Z_RPNQuery *rpn);
189 void zlog_scan (Z_AttributesPlusTerm *zapt, oid_value ast);
191 int zebra_server_lock_init (ZServerInfo *zi);
192 int zebra_server_lock_destroy (ZServerInfo *zi);
193 int zebra_server_lock (ZServerInfo *zi, int lockCommit);
194 void zebra_server_unlock (ZServerInfo *zi, int commitPhase);
195 int zebra_server_lock_get_state (ZServerInfo *zi, time_t *timep);
197 typedef struct attent
200 data1_local_attribute *local_attributes;
203 int att_getentbyatt(ZServerInfo *zi, attent *res, oid_value set, int att);