A few notes about the server.
[idzebra-moved-to-github.git] / doc / zebra.sgml
1 <!doctype linuxdoc system>
2
3 <!--
4   $Id: zebra.sgml,v 1.3 1995-11-28 15:59:46 adam Exp $
5 -->
6
7 <article>
8 <title>Zebra server Administrators's Guide and Reference
9 <author>Index Data, <tt/info@index.ping.dk/
10 <date>$Revision: 1.3 $
11 <abstract>
12 This document describes Zebra &mdash; an information retrieval server
13 that uses the Z39.50 protocol.
14 </abstract>
15
16 <toc>
17
18 <sect>Introduction
19
20 <p>
21 - gils
22 - UNI*X (not NT yet)
23 - goals
24
25 <sect>Compiling the software
26
27 <p>
28
29 Zebra uses the YAZ package in order to provide Z39.50 access. So you
30 must compile YAZ before going further. Specifically, Zebra uses
31 the YAZ header files in <tt>yaz/include/..</tt> and its public library
32 <tt>yaz/lib/libyaz.a</tt>.
33
34 As with YAZ, an ANSI C compiler is required in order to compile the Zebra
35 server system &mdash; GNU C works fine.
36
37 Unpack the Zebra software. You might put Zebra in the same directory level
38 as YAZ, for example if YAZ is placed in ..<tt>/src/yaz-</tt>.., then
39 Zebra is placed in ..<tt>/src/zebra-</tt>.
40
41 Edit the top-level <tt>Makefile</tt> in the Zebra directory in which
42 you specify the location of YAZ by setting make variables.
43 The <tt>OSILIB</tt> should be empty if YAZ wasn't compiled with
44 MOSI support. Some systems, such as Solaris, have separate socket
45 libraries and for those systems you need to specify the
46 <tt>NETLIB</tt> variable.
47
48 When finished editing the <tt>Makefile</tt> type:
49 <tscreen><verb>
50 $ make
51 </verb></tscreen>
52
53 If successful, two executables have been created in the sub-directory
54 index.
55 <descrip>
56 <tag><tt>zebrasrv</tt></tag> The Z39.50 server and search engine.
57 <tag><tt>zebraidx</tt></tag> The administrative tool for the search index.
58 </descrip>
59
60 <sect>Quick getting started
61
62 <p>
63 This section will get you started quickly! We will try to index a few
64 GILS records that are included with the Zebra distribution. Go to the
65 <tt>test</tt> subdirectory. There you will find a configuration
66 file named <tt>zebra.cfg</tt> with the following contents:
67 <tscreen><verb>
68 # Where are the YAZ tables located.
69 profilePath: /usr/local/yaz
70
71 # Files that describe the attribute sets supported.
72 attset: bib1.att
73 attset: gils.att
74 </verb></tscreen>
75
76 Now, edit the file and set <tt>profilePath</tt> to the path of the
77 YAZ profile tables (sub directory <tt>tab</tt> of YAZ).
78
79 The 48 test records are located in the sub directory <tt>records</tt>.
80 To index these, type:
81 <tscreen><verb>
82 $ ../index/zebraidx -t grs update records
83 </verb></tscreen>
84
85 In the command above the option <tt>-t</tt> specified the record
86 type &mdash; in this case <tt>grs</tt>. The word <tt>update</tt> followed
87 by a directory root updates all files below that directory.
88
89 If your indexing command went successful, you are now ready to
90 setup a server. To start a server on port 2100, type:
91 <tscreen><verb>
92 $ ../index/zebrasrv tcp:@:2100
93 </verb></tscreen>
94
95 The Zebra server just made has one database called Default. It will
96 return either USMARC/GRS or SUTRS depending on your client.
97
98 <sect>Administrating Zebra
99
100 <p>
101
102 Unlike many other retrieval systems, Zebra offers incremental
103 modifications of an existing index. Needless to say, these facilities
104 makes the administration of Zebra somewhat more complicated.
105
106 Normally, when Zebra modifies the index it reads a number of records
107 that you specify.
108 Depending on your specifications and on the contents of each record
109 one the following scenarios occur:
110 <descrip>
111 <tag>Insert</tag> The record is indexed as if it never occurred
112 before. Either the Zebra system doesn't know how to identify the record or
113 Zebra can identify the record but didn't find it to be already indexed.
114 <tag>Modify</tag> The record has already been indexed. In this case
115 either the contents of the record or the location (file) of the record
116 indicates that it has been indexed before.
117 <tag>Delete</tag> The record is deleted from the index. As in the
118 update-case it must be able to identify the record.
119 </descrip>
120
121 Please note, that in both the modify- and delete- case the Zebra
122 system must be able to make a key that identifies the record in
123 question.
124
125 To administrate the Zebra retrieval system, you run the
126 <tt>zebraidx</tt> program. This program supports a number of options
127 which are preceded by a minus, and a few commands (not preceded by
128 minus).
129
130 Both the Zebra administrative tool and the Z39.50 server share a
131 set of indexing files and a global configuration file. The
132 name of the configuration file defaults to <tt>zebra.cfg</tt>.
133 The configuration file includes specifications on how to index
134 various kinds of records and where the other configuration files
135 are located. <tt>zebrasrv</tt> and <tt>zebraidx</tt> <em>must</em>
136 be run in the same directory where the configuration file if you do
137 not indicate the location of the configuration file by option
138 <tt>-c</tt>.
139
140 <sect1>Record types
141 <p>
142 Indexing is a record-per-record process, in which
143 either insert/modify/delete will occur. Before a record is indexed
144 search keys are extracted from whatever might be the layout the
145 original record (sgml,html,text, etc..). The Zebra system 
146 currently only support GILS records and simple text records.
147 To specify a particular extraction process, use either the
148 command line option <tt>-t</tt> or specify a
149 <tt>recordType</tt> setting in the configuration file.
150
151 <sect1>The Zebra configuration file
152 <p>
153 The Zebra configuration file, read by <tt>zebraidx</tt> and
154 <tt>zebrasrv</tt> defaults to <tt>zebra.cfg</tt> unless specified
155 by <tt>-c</tt> option.
156
157 You can edit the configuration file with a normal text editor.
158 Setting names and values are seperated by colons in the file. Lines
159 starting with a hash sign (<tt/#/) are treated as comments.
160
161 A set of records that share common characteristics are called a group.
162 When <tt>zebraidx</tt> is run and you wish to address a given group
163 you specify that group with the <tt>-g</tt> option. In this case
164 settings that have the group name as their prefix will be used
165 by <tt>zebraidx</tt> and not default values.
166
167 The group is written before the option itself separated by a dot.
168 For example to set the record type for group <tt/public/ to <tt/grs/
169 you would write:
170 <tscreen><verb>
171 public.recordType: grs
172 </verb></tscreen>
173
174 To set the default value of the record type to text write:
175 <tscreen><verb>
176 recordType: text
177 </verb></tscreen>
178
179 The configuration settings are summarized below. They will be
180 explained further in the following chapters.
181
182 <descrip>
183 <tag><it>group</it>recordType<it>name</it></tag>
184  Specifies how records with the file extension <it>name</it> should
185  be handled by the indexer. This option may also be specified
186  as a command line option (<tt>-t</tt>).
187 <tag><it>group</it>recordId</tag>
188  Specifies how the record is to be identified when updated.
189 <tag><it>group</it>database</tag>
190  Specifies the Z39.50 database.
191 <tag><it>group</it>storeKeys</tag>
192  Specifies whether key information should be saved for a given
193  group of records. If you plan to update/delete this type of
194  record a later this should be specified as 1; otherwise it
195  should be 0 (default).
196 <tag><it>group</it>storeData</tag>
197  Specifies whether original copy of record should be stored internally
198  in the Zebra system indexes. If your externally indexed files
199  are temporary this option should certainly be true (1); otherwise
200  false (0).
201 <tag>register</tag> 
202  Specifies the location of the indexes.
203 <tag>profilePath</tag>
204  Specifies the location of profile specification paths.
205 <tag>attset</tag> 
206  Specifies the filename(s) of attribute specification files.
207 </descrip>
208
209 <sect1>Locating records
210 <p>
211 The default behaviour of the Zebra system is to reference the
212 records from their original location, i.e. where they were
213 read an indexed.
214
215 If your records files are temporary for example if you retrieve
216 them from the outside or if they where temporarily mounted on a CD-ROM,
217 you may want the Zebra server to make a copy of them. To do this
218 you specify 1 (true) in the <tt>storedata</tt> setting. When
219 the Z39.50 search engine retrieves recoreds they will be read from an
220 internal structure of the index.
221
222 <sect1>Indexing with no record Ids
223
224 <p>
225 If you have a set of records that you <em/never/ wish to delete
226 or modify you may find 'indexing with no records Ids' convenient.
227 This indexing method uses less space than the other methods and
228 is simple to use. 
229
230 To use this method, you simply don't specify the <tt>recordId</tt> 
231 for the group of files you index. To add a set of records you use
232 <tt>zebraidx</tt> with the <tt>update</tt> command. The
233 <tt>update</tt> command will always add the records to the index
234 becuase Zebra doesn't know how to match the new set of records with
235 existing records.
236
237 Consider a system, in which you have a group of text files called
238 <tt>simple</tt>. That group of records should belong to a Z39.50 database
239 called <tt>textbase</tt>. The following configuration file suffice:
240
241 <tscreen><verb>
242 profilePath: /usr/local/yaz
243 attset: bib1.att
244 attset: gils.att
245 simple.recordType: text
246 simple.database: textbase
247 </verb></tscreen>
248
249 <sect1>Indexing with file record Ids
250
251 <p>
252 If you have a set of external records that you wish to index you may
253 use the file key feature of the Zebra system. In short, the file key
254 feature, mirrors a directory and the files below efficiently. To
255 perform indexing of a directory with file keys, you specify the top-level
256 directory after the <tt>update</tt> command. The command will recursively
257 traverse the directories and compare each with whatever have been
258 indexed before in the same directory. If a file is new (not in
259 the previous version of the directory) it is inserted;
260 if a file was already indexed and it has been modified
261 since the last insertion the index is also modified; if a file is missing
262 since the last visit it is deleted.
263
264 The resulting system is easy to administer. To delete a record
265 you simply have to delete the corresponding file (with <tt/rm/). 
266 To force update of a given file, you may use the <tt>touch</tt>
267 command. And to add files create new files (or directories with files).
268 For your changes to take effect you must run <tt>zebraidx</tt> with
269 the same directory root again.
270
271 To use this method, you must specify <tt>file</tt> as the value
272 of <tt>recordId</tt> the configuration file. In the configuration
273 also set <tt>storeKeys</tt> to <tt>1</tt>, since the Zebra
274 indexer must save additional information in order to
275 modify/delete the record at a later time.
276
277 For example, to update group <tt>esdd</tt> records below
278 <tt>/home/grs</tt> you could type:
279 <tscreen><verb>
280 $ zebraidx -g esdd update /home/grs
281 </verb></tscreen>
282
283 The corresponding configuration file includes:
284 <tscreen><verb>
285 esdd.recordId: file
286 esdd.recordType: grs
287 esdd.storeKeys: 1
288 </verb></tscreen>
289
290 <em>Important note: You cannot start by a group of records with simple
291 indexing (no record ids as in the previous section) and then, later,
292 use file record Ids. The Zebra must know from the very beginning that
293 the group of files are indexed with file record Ids.
294 </em>
295
296 <sect1>Indexing with general record Ids
297 <p>
298 When using this method you specify an (almost) arbritrary record key
299 based on the contents of the record itself and other system
300 information. If you have a group of records that have an external
301 id attached, this method is convenient. For example, the record may
302 contain a title or an unique id. In either case you specify the 
303 Z39.50 attribute-set and attribute-use location in which this
304 information is stored.
305
306 As before, the record id is defined by the <tt>recordId</tt> setting
307 in the configuration file. The value of the record id consists of one
308 or more tokens separated by space. The resulting id is formed
309 by concatenating the tokens and separete them by ascii value (1).
310
311 There are three kinds of tokens:
312 <descrip>
313 <tag>Internal record info</tag> The token refers to a key that is
314 extracted from the record. The syntax of this token is
315  <tt/(/ <em/set/ <tt/,/ <em/use/ <tt/)/, where <em/set/ is the
316 attribute set number and <em/use/ is the use value of the attribute.
317 <tag>System variable</tag> The system variables are preceded by
318 <tt>$</tt> and immediately followed by the system variable name, which
319 may one of
320  <descrip>
321  <tag>group</tag> Group name.
322  <tag>database</tag> Current database specified.
323  <tag>filename</tag> Name of file that contain the record.
324  <tag>type</tag> Record type.
325  </descrip>
326 <tag>Constant string</tag> A string used as part of id &mdash; surrounded
327  by single- or double quotes.
328 </descrip>
329
330 The test GILS records that comes with Zebra, contain a unique id
331 in the Control-Identifier field. This field is mapped to the Bib-1
332 use attribute 1007. To use this field as a record id, specify
333 <tt>(1,1007)</tt> as the value of the <tt>recordId</tt> in the
334 configuration file. If you have other record types that doesn't
335 contain an id in the same field, you might add the record type
336 in the record id of the gils records as well, to prevent match
337 of other types of records. In this case the recordId might be
338 set, as in:
339 <tscreen><verb>
340 gils.recordId: $type (1,1007)
341 </verb></tscreen>
342
343 As for the file record id case described in the previous section
344 updating your system is simply a matter of running <tt>zebraidx</tt>
345 with the <tt>update</tt> command. However, the update of with general
346 keys is considerably slower than with file record ids, since all files
347 visited must be (re)indexded. 
348
349 <sect1>Register location
350
351 <p>
352 Normally, the index files that form dictionaries, inverted
353 file, record info, etc. are stored in the current directory in which you run
354 <tt>zebraidx</tt>. If you wish to store those, possibly large, files
355 somewhere else, you must set the <tt>register</tt> setting in the
356 configuration file. Furhtermore, the Zebra system handles indexes that
357 span multiple file systems, which is usefull if a large number of
358 records are indexed.
359
360 The value <tt>register</tt> of register is a sequence of tokens.
361 Each token takes the form:
362 <tscreen>
363 <em>dir</em><tt>:</tt><em>size</em>. 
364 </tscreen>
365 The <em>dir</em> specifies a directory in which index files will be
366 stored and the <em>size</em> specifies the maximum size of all
367 files in that directory. The Zebra indexer system fill each directory
368 in the order specified and use the next specified directories as needed.
369 The <em>size</em> is an integer possibly followed by a quantity
370 code, <tt>M</tt> for Mega bytes, <tt>K</tt> for Kilo bytes.
371
372 If you have two spare disks :) and the first disk is mounted
373 on <tt>/d1</tt> and has 200 Mega bytes free space after formatting and the
374 second, mounted on <tt>/d2</tt> has 300 Mega bytes free, you could
375 specify the following in you configuration file:
376 <tscreen><verb>
377 register: /d1:200M /d2:300M
378 </verb></tscreen>
379
380 <sect>The Z39.50 Server
381
382 <p>
383
384 <sect1>Running the server
385 <p>
386 The server <tt>zebrasrv</tt> supports the same set of options as the 
387 test server <tt>ztest</tt> that comes with YAZ. As for the 
388 <tt>zebraidx</tt> the option <tt>-c</tt> specifies the configuration
389 filename. When the Zebra server is executed with its normal log level it 
390 prints (not too detailed) information about the incoming queries. 
391 This is useful if you don't happen to know what attributes your client sends.
392
393 Note that the server doesn't support the static mode (-S). 
394
395 <sect1>How the server handles queries
396 <p>
397
398 <sect>About Index Data
399 <p>
400 Copyright &copy; 1995, Index Data.
401
402 Permission to use, copy, modify, distribute, and sell this software and
403 its documentation, in whole or in part, for any purpose, is hereby granted,
404 provided that:
405
406 1. This copyright and permission notice appear in all copies of the
407 software and its documentation. Notices of copyright or attribution
408 which appear at the beginning of any file must remain unchanged.
409
410 2. The names of Index Data or the individual authors may not be used to
411 endorse or promote products derived from this software without specific
412 prior written permission.
413
414 THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
415 EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
416 WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
417 IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
418 INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
419 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
420 NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
421 LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
422 OF THIS SOFTWARE.
423
424 <sect>About Index Data
425
426 <p>
427 Index Data is a consulting and software-development enterprise that
428 specialises in library and information management systems. Our
429 interests and expertise span a broad range of related fields, and one
430 of our primary, long-term objectives is the development of a powerful
431 information management
432 system with open network interfaces and hypermedia capabilities.
433
434 We make this software available free of charge, on a fairly unrestrictive
435 license; as a service to the networking community, and to further the
436 development of quality software for open network communication.
437
438 We'll be happy to answer questions about the software, and about ourselves
439 in general.
440
441 <tscreen>
442 Index Data&nl
443 Ryesgade 3&nl
444 2200 K&oslash;benhavn N&nl
445 DENMARK
446 </tscreen>
447
448 <p>
449 <tscreen><verb>
450 Phone: +45 3536 3672
451 Fax  : +45 3536 0449
452 Email: info@index.ping.dk
453 </verb></tscreen>
454
455 <sect>References
456
457 <p>
458
459 </article>