40e9103d50d111ed7dd27f98e00ed0975b5234ad
[pazpar2-moved-to-github.git] / doc / pazpar2_conf.xml
1 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"
2  "http://www.oasis-open.org/docbook/xml/4.1/docbookx.dtd"
3 [
4      <!ENTITY % local SYSTEM "local.ent">
5      %local;
6      <!ENTITY % entities SYSTEM "entities.ent">
7      %entities;
8      <!ENTITY % common SYSTEM "common/common.ent">
9      %common;
10 ]>
11 <!-- $Id: pazpar2_conf.xml,v 1.16 2007-04-09 05:11:49 quinn Exp $ -->
12 <refentry id="pazpar2_conf">
13  <refentryinfo>
14   <productname>Pazpar2</productname>
15   <productnumber>&version;</productnumber>
16  </refentryinfo>
17  <refmeta>
18   <refentrytitle>Pazpar2 conf</refentrytitle>
19   <manvolnum>5</manvolnum>
20  </refmeta>
21  
22  <refnamediv>
23   <refname>pazpar2_conf</refname>
24   <refpurpose>Pazpar2 Configuration</refpurpose>
25  </refnamediv>
26  
27  <refsynopsisdiv>
28   <cmdsynopsis>
29    <command>pazpar2.conf</command>
30   </cmdsynopsis>
31  </refsynopsisdiv>
32  
33  <refsect1><title>DESCRIPTION</title>
34    <para>
35      The pazpar2 configuration file, together with any referenced XSLT files,
36      govern pazpar2's behavior as a client, and control the normalization and
37      extraction of data elements from incoming result records, for the
38      purposes of merging, sorting, facet analysis, and display.
39     </para>
40
41     <para>
42       The file is specified using the option -f on the pazpar2 command line.
43       There is not presently a way to reload the configuration file without
44       restarting pazpar2, although this will most likely be added some time
45       in the future.
46     </para>
47  </refsect1>
48
49  <refsect1><title>FORMAT</title>
50    <para>
51      The configuration file is XML-structured. It must be valid XML. All
52      elements specific to pazpar2 should belong to the namespace
53      "http://www.indexdata.com/pazpar2/1.0" (this is assumed in the
54      following examples). The root element is named 'pazpar2'. Under the
55      root element are a number of elements which group categories of
56      information. The categories are described below.
57     </para>
58
59     <refsect2 id="config-server"><title>server</title>
60       <para>
61         This section governs overall behavior of the client. The data
62         elements are described below.
63       </para>
64       <variablelist> <!-- level 1 -->
65         <varlistentry>
66           <term>listen</term>
67           <listitem>
68             <para>
69               Configures the webservice -- this controls how you can connect
70               to pazpar2 from your browser or server-side code. The
71               attributes 'host' and 'port' control the binding of the
72               server. The 'host' attribute can be used to bind the server to
73               a secondary IP address of your system, enabling you to run
74               pazpar2 on port 80 alongside a conventional web server. You
75               can override this setting on the command lineusing the option -h.
76             </para>
77           </listitem>
78         </varlistentry>
79
80         <varlistentry>
81           <term>proxy</term>
82           <listitem>
83             <para>
84               If this item is given, pazpar2 will forward all incoming HTTP
85               requests that do not contain the filename 'search.pz2' to the
86               host and port specified using the 'host' and 'port'
87               attributes. The 'myurl' attribute is required, and should provide
88               the base URL of the server. Generally, the HTTP URL for the host
89               specified in the 'listen' parameter. This functionality is
90               crucial if you wish to use
91               pazpar2 in conjunction with browser-based code (JS, Flash,
92               applets, etc.) which operates in a security sandbox. Such code
93               can only connect to the same server from which the enclosing
94               HTML page originated. Pazpar2s proxy functionality enables you
95               to host all of the main pages (plus images, CSS, etc) of your
96               application on a conventional webserver, while efficiently
97               processing webservice requests for metasearch status, results,
98               etc.
99             </para>
100           </listitem>
101         </varlistentry>
102
103         <varlistentry>
104           <term>zproxy</term>
105           <listitem>
106             <para>
107               If this item is given, pazpar2 will send all Z39.50
108               packages through this Z39.50 proxy server.
109               At least one of the 'host' and 'post' attributes is required.
110               The 'host' attribute may contain both host name and port
111               number, seperated by a colon ':', or only the host name.
112               An empty 'host' attribute sets the Z39.50 host address
113               to 'localhost'.  
114             </para>
115           </listitem>
116         </varlistentry>
117
118         <varlistentry>
119           <term>service</term>
120           <listitem>
121             <para>
122               This nested element controls the behavior of pazpar2 with
123               respect to your data model. In pazpar2, incoming records are
124               normalized, using XSLT, into an internal representation.
125               The 'service' section controls the further processing and
126               extraction of data from the internal representation, primarily
127               through the 'metdata' sub-element.
128             </para>
129
130             <variablelist> <!-- Level 2 -->
131               <varlistentry><term>metadata</term>
132                 <listitem>
133                   <para>
134                     One of these elements is required for every data element in
135                     the internal representation of the record (see
136                     <xref linkend="data_model"/>. It governs
137                     subsequent processing as pertains to sorting, relevance
138                     ranking, merging, and display of data elements. It supports
139                     the following attributes:
140                   </para>
141
142                   <variablelist> <!-- level 3 -->
143                     <varlistentry><term>name</term>
144                       <listitem>
145                         <para>
146                           This is the name of the data element. It is matched
147                           against the 'type' attribute of the 'metadata' element
148                           in the normalized record. A warning is produced if
149                           metdata elements with an unknown name are found in the
150                           normalized record. This name is also used to represent
151                           data elements in the records returned by the
152                           webservice API, and to name sort lists and browse
153                           facets.
154                         </para>
155                       </listitem>
156                     </varlistentry>
157
158                     <varlistentry><term>type</term>
159                      <listitem>
160                         <para>
161                           The type of data element. This value governs any
162                           normalization or special processing that might take
163                           place on an element. Possible values are 'generic'
164                           (basic string), 'year' (a range is computed if
165                           multiple years are found in the record). Note: This
166                           list is likely to increase in the future.
167                         </para>
168                       </listitem>
169                     </varlistentry>
170
171                     <varlistentry><term>brief</term>
172                       <listitem>
173                         <para>
174                           If this is set to 'yes', then the data element is
175                           includes in brief records in the webservice API. Note
176                           that this only makes sense for metadata elements that
177                           are merged (see below). The default value is 'no'.
178                         </para>
179                       </listitem>
180                     </varlistentry>
181
182                     <varlistentry><term>sortkey</term>
183                       <listitem>
184                         <para>
185                           Specifies that this data element is to be used for
186                           sorting. The possible values are 'numeric' (numeric
187                           value), 'skiparticle' (string; skip common, leading
188                           articles), and 'no' (no sorting). The default value is
189                           'no'.
190                         </para>
191                       </listitem>
192                     </varlistentry>
193
194                     <varlistentry><term>rank</term>
195                       <listitem>
196                         <para>
197                           Specifies that this element is to be used to help rank
198                           records against the user's query (when ranking is
199                           requested). The value is an integer, used as a
200                           multiplier against the basic TF*IDF score. A value of
201                           1 is the base, higher values give additional weight to
202                           elements of this type. The default is '0', which
203                           excludes this element from the rank calculation.
204                         </para>
205                       </listitem>
206                     </varlistentry>
207
208                     <varlistentry><term>termlist</term>
209                       <listitem>
210                         <para>
211                           Specifies that this element is to be used as a
212                           termlist, or browse facet. Values are tabulated from
213                           incoming records, and a highscore of values (with
214                           their associated frequency) is made available to the
215                           client through the webservice API. The possible values
216                           are 'yes' and 'no' (default).
217                         </para>
218                       </listitem>
219                     </varlistentry>
220
221                     <varlistentry><term>merge</term>
222                       <listitem>
223                         <para>
224                           This governs whether, and how elements are extracted
225                           from individual records and merged into cluster
226                           records. The possible values are: 'unique' (include
227                           all unique elements), 'longest' (include only the
228                           longest element (strlen), 'range' (calculate a range
229                           of values across al matching records), 'all' (include
230                           all elements), or 'no' (don't merge; this is the
231                           default);
232                         </para>
233                       </listitem>
234                     </varlistentry>
235                   </variablelist> <!-- attributes to metadata -->
236
237                 </listitem>
238               </varlistentry>
239             </variablelist>     <!-- Data elements in service directive -->
240           </listitem>
241         </varlistentry>
242       </variablelist>           <!-- Data elements in server directive -->
243     </refsect2>
244
245   </refsect1>
246  
247  <refsect1><title>EXAMPLE</title>
248   <para>Below is a working example configuration:
249   <screen><![CDATA[
250 <?xml version="1.0" encoding="UTF-8"?>
251 <pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
252
253 <server>
254   <listen port="9004"/>
255   <proxy host="us1.indexdata.com" myurl="us1.indexdata.com"/>
256
257   <!-- <zproxy host="localhost" port="9000"/> -->
258   <!-- <zproxy host="localhost:9000"/> -->
259   <!-- <zproxy port="9000"/> -->
260
261   <service>
262     <metadata name="title" brief="yes" sortkey="skiparticle" merge="longest" rank="6"/>
263     <metadata name="isbn" merge="unique"/>
264     <metadata name="date" brief="yes" sortkey="numeric" type="year" merge="range"
265             termlist="yes"/>
266     <metadata name="author" brief="yes" termlist="yes" merge="longest" rank="2"/>
267     <metadata name="subject" merge="unique" termlist="yes" rank="3"/>
268     <metadata name="url" merge="unique"/>
269   </service>
270 </server>
271
272 </pazpar2>
273 ]]></screen>
274    </para>
275  </refsect1> 
276
277  <refsect1><title>TARGET SETTINGS</title>
278    <para>
279      Pazpar2 features a cunning scheme by which you can associate various
280      kinds of attributes, or settings with search targets. This is done
281      through XML files; each file can associate one or more settings
282      with one or more targets. The file format is generic in nature,
283      designed to support a wide range of application requirements. The
284      settings can be purely technical things, like, how to perform a title
285      search against a given target, or it can associate arbitrary name=value
286      pairs with groups of targets -- for instance, if you would like to
287      place all commercial full-text bases in one group for selection
288      purposes, or you would like to control what targets are accessible to a
289      given user.
290    </para>
291
292    <para>
293      During startup, pazpar2 will recursively read a specified directory
294      (can be identified in the pazpar2.cfg file or on the command line), and
295      process any settings files found therein.
296    </para>
297
298    <refsect2><title>SETTINGS FILE FORMAT</title>
299      <para>
300        Each file contains a root element named &lt;settings&gt;. It may
301        contain one or more &lt;set&gt; elements. The settings and set
302        elements may contain the following attributes. Attributes in set
303        overrides those in the setting root element. Each set node must
304        specify (directly, or inherited from the parent node) at least a
305        target, name, and value.
306      </para>
307
308      <variablelist> 
309        <varlistentry>
310          <term>target</term>
311          <listitem>
312            <para>
313              This specifies the search target to which this setting should be
314              applied. Targets are identified by their Z39.50 URL, generally
315              including the host, port, and database name, (e.g.
316              bagel.indexdata.com:210/marc). Two wildcard forms are accepted:
317              * (asterisk) matches all known targets;
318              bagel.indexdata.com:210/* matches all known databases on the given
319              host.
320            </para>
321            <para>
322              A precedence system determines what happens if there are
323              overlapping values for the same setting name for the same
324              target. A setting for a specific target name overrides a
325              setting whch specifies target using a wildcard. This makes it
326              easy to set defaults for all targets, and then override them
327              for specific targets or hosts. If there are
328              multiple overlapping settings with the same name and target
329              value, the 'precedence' attribute determines what happens.
330             </para>
331          </listitem>
332        </varlistentry>
333        <varlistentry>
334          <term>user</term>
335          <listitem>
336            <para>
337              This specifies the user ID to which this setting applies. A
338              given setting may have values for any number of users, or it
339              may have a 'default' value which is applied when no user is
340              specified, or when no user-specific value is available.
341             </para>
342           </listitem>
343         </varlistentry>
344         <varlistentry>
345           <term>name</term>
346           <listitem>
347             <para>
348               The name of the setting. This can be anything you like.
349               However, pazpar2 reserves a number of setting names for
350               specific purposes, all starting with 'pz:', and it is a good
351               idea to avoid that prefix if you make up your own setting
352               names. See below for a list of reserved variables.
353             </para>
354           </listitem>
355         </varlistentry>
356         <varlistentry>
357           <term>value</term>
358           <listitem>
359             <para>
360               The value of the setting. Generally, this can be anything you
361               want -- however, some of the reserved settings may expect
362               specific kinds of values.
363             </para>
364           </listitem>
365         </varlistentry>
366         <varlistentry>
367           <term>precedence</term>
368           <listitem>
369             <para>
370               This should be an integer. If not provided, the default value
371               is 0. If two (or more) settings have the same content for
372               target and name, the precedence value determines the outcome.
373               If both settings have the same precedence value, they are both
374               applied to the target(s). If one has a higher value, then the
375               value of that setting is applied, and the other one is ignored.
376             </para>
377           </listitem>
378         </varlistentry>
379       </variablelist>
380
381       <para>
382         By setting defaults for user, target, name, or value in the root
383         settings node, you can use the settings files in many different
384         ways. For instance, you can use a single file to set defaults for
385         many different settings, like search fields, retrieval syntaxes,
386         etc. You can have one file per server, which groups settings for
387         that server or target. You could also have one file which associates
388         a number of targets with a given setting, for instance, to associate
389         many databases with a given category or class that makes sense
390         within your application.
391       </para>
392
393     </refsect2>
394
395     <refsect2><title>RESERVED SETTING NAMES</title>
396       <para>
397         The following setting names are reserved by pazpar2 to control the
398         behavior of the client function.
399       </para>
400
401       <variablelist>
402         <varlistentry>
403           <term>pz:cclmap:xxx</term>
404           <listitem>
405             <para>
406               This establishes a CCL field definition or other setting, for
407               the purpose of mapping end-user queries. XXX is the field or
408               setting name, and the value of the setting provides parameters
409               (e.g. parameters to send to the server, etc.). Please consult
410               the YAZ manual for a full overview of the many capabilities of
411               the powerful and flexible CCL parser.
412             </para>
413             <para>
414               Note that it is easy to etablish a set of default parameters,
415               and then override them individually for a given target.
416             </para>
417           </listitem>
418         </varlistentry>
419         <varlistentry>
420           <term>pz:requestsyntax</term>
421           <listitem>
422             <para>
423               This specifies the record syntax to use when requesting
424               records from a given server. The value can be a symbolic name like
425               marc21 or xml, or it can be a Z39.50-style dot-separated OID.
426             </para>
427           </listitem>
428         </varlistentry>
429         <varlistentry>
430           <term>pz:elements</term>
431           <listitem>
432             <para>
433               The element set name to be used when retrieving records from a
434               server.
435             </para>
436           </listitem>
437         </varlistentry>
438         <varlistentry>
439           <term>pz:piggyback</term>
440           <listitem>
441             <para>
442               Piggybacking enables the server to retrieve records from the
443               server as part of the search response in Z39.50. Almost all
444               servers support this (or fail it gracefully), but a few
445               servers will produce undesirable results.
446               Set to '1' to enable piggybacking, '0' to disable it. Default
447               is 1 (piggybacking enabled).
448             </para>
449           </listitem>
450         </varlistentry>
451         <varlistentry>
452           <term>pz:nativesyntax</term>
453           <listitem>
454             <para>
455               The representation of the retrieval records. Currently
456               recognized values are iso2709 and xml.
457             </para>
458           </listitem>
459         </varlistentry>
460         <varlistentry>
461           <term>pz:encoding</term>
462           <listitem>
463             <para>
464               The native encoding of retrieval records. Can be anything
465               recognized by conv, but typical values are marc8 and latin1.
466               The default is UTF-8.
467             </para>
468           </listitem>
469         </varlistentry>
470         <varlistentry>
471           <term>pz:xslt</term>
472           <listitem>
473             <para>
474               Provides the path of an XSLT stylesheet which will be used to
475               map incoming records to the internal representation.
476             </para>
477           </listitem>
478         </varlistentry>
479         <varlistentry>
480           <term>pz:authentication</term>
481           <listitem>
482             <para>
483               Sets an authentication string for a given server. See the section on
484               authorization and authentication for discussion.
485             </para>
486           </listitem>
487         </varlistentry>
488         <varlistentry>
489           <term>pz:allow</term>
490           <listitem>
491             <para>
492               Allows or denies access to the resources it is applied to. Possible
493               values are '0' and '1'. The default is '1' (allow access to this resource).
494               See the manual section on authorization and authentication for discussion
495               about how to use this setting.
496             </para>
497           </listitem>
498         </varlistentry>
499       </variablelist>
500     </refsect2>
501
502  </refsect1>
503 </refentry>
504 <!-- Keep this comment at the end of the file
505 Local variables:
506 mode: sgml
507 sgml-omittag:t
508 sgml-shorttag:t
509 sgml-minimize-attributes:nil
510 sgml-always-quote-attributes:t
511 sgml-indent-step:1
512 sgml-indent-data:t
513 sgml-parent-document:nil
514 sgml-local-catalogs: nil
515 sgml-namecase-general:t
516 End:
517 -->