Documentation up to date with available settings (allow and maxrecs not yet implemented).
[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.20 2007-04-11 03:34:11 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 id="target_settings"><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
289      to users by default.
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    <para>
299      Clients of the pazpar2 webservice interface can selectively override
300      settings for individual targets within the scope of one session. This
301      can be used in conjunction with an external authentication system to
302      determine which resources are to be accessible to which users. Pazpar2
303      itself has no notion of end-users, and so can be used in conjunction
304      with any type of authentication system. Similarly, the authentication
305      tokens submitted to access-controlled search targets can similarly be
306      overriden, to allow use of pazpar2 in a consortial or multi-library
307      environment, where different end-users may need to be represented to
308      some search targets in different ways. This, again, can be managed
309      using an external database or other lookup mechanism.
310     </para>
311
312    <refsect2><title>SETTINGS FILE FORMAT</title>
313      <para>
314        Each file contains a root element named &lt;settings&gt;. It may
315        contain one or more &lt;set&gt; elements. The settings and set
316        elements may contain the following attributes. Attributes in the set node
317        overrides those in the setting root element. Each set node must
318        specify (directly, or inherited from the parent node) at least a
319        target, name, and value.
320      </para>
321
322      <variablelist> 
323        <varlistentry>
324          <term>target</term>
325          <listitem>
326            <para>
327              This specifies the search target to which this setting should be
328              applied. Targets are identified by their Z39.50 URL, generally
329              including the host, port, and database name, (e.g.
330              bagel.indexdata.com:210/marc). Two wildcard forms are accepted:
331              * (asterisk) matches all known targets;
332              bagel.indexdata.com:210/* matches all known databases on the given
333              host.
334            </para>
335            <para>
336              A precedence system determines what happens if there are
337              overlapping values for the same setting name for the same
338              target. A setting for a specific target name overrides a
339              setting whch specifies target using a wildcard. This makes it
340              easy to set defaults for all targets, and then override them
341              for specific targets or hosts. If there are
342              multiple overlapping settings with the same name and target
343              value, the 'precedence' attribute determines what happens.
344             </para>
345          </listitem>
346        </varlistentry>
347         <varlistentry>
348           <term>name</term>
349           <listitem>
350             <para>
351               The name of the setting. This can be anything you like.
352               However, pazpar2 reserves a number of setting names for
353               specific purposes, all starting with 'pz:', and it is a good
354               idea to avoid that prefix if you make up your own setting
355               names. See below for a list of reserved variables.
356             </para>
357           </listitem>
358         </varlistentry>
359         <varlistentry>
360           <term>value</term>
361           <listitem>
362             <para>
363               The value of the setting. Generally, this can be anything you
364               want -- however, some of the reserved settings may expect
365               specific kinds of values.
366             </para>
367           </listitem>
368         </varlistentry>
369         <varlistentry>
370           <term>precedence</term>
371           <listitem>
372             <para>
373               This should be an integer. If not provided, the default value
374               is 0. If two (or more) settings have the same content for
375               target and name, the precedence value determines the outcome.
376               If both settings have the same precedence value, they are both
377               applied to the target(s). If one has a higher value, then the
378               value of that setting is applied, and the other one is ignored.
379             </para>
380           </listitem>
381         </varlistentry>
382       </variablelist>
383
384       <para>
385         By setting defaults for target, name, or value in the root
386         settings node, you can use the settings files in many different
387         ways. For instance, you can use a single file to set defaults for
388         many different settings, like search fields, retrieval syntaxes,
389         etc. You can have one file per server, which groups settings for
390         that server or target. You could also have one file which associates
391         a number of targets with a given setting, for instance, to associate
392         many databases with a given category or class that makes sense
393         within your application.
394       </para>
395
396       <para>
397         The following examples illustrate uses of the settings system to
398         associate settings with targets to meet different requirements.
399       </para>
400
401       <para>
402         The example below associates a set of default values that can be
403         used across many targets. Note the wildcard for targets.
404         This associates the given settings with all targets for which no
405         other information is provided.
406         <screen><![CDATA[
407 <settings target="*">
408
409   <!-- This file introduces default settings for pazpar2 -->
410   <!-- $Id: pazpar2_conf.xml,v 1.20 2007-04-11 03:34:11 quinn Exp $ -->
411
412   <!-- mapping for unqualified search -->
413   <set name="pz:cclmap:term" value="u=1016 t=l,r s=al"/>
414
415   <!-- field-specific mappings -->
416   <set name="pz:cclmap:ti" value="u=4 s=al"/>
417   <set name="pz:cclmap:su" value="u=21 s=al"/>
418   <set name="pz:cclmap:isbn" value="u=7"/>
419   <set name="pz:cclmap:issn" value="u=8"/>
420   <set name="pz:cclmap:date" value="u=30 r=r"/>
421
422   <!-- Retrieval settings -->
423
424   <set name="pz:requestsyntax" value="marc21"/>
425   <!-- <set name="pz:elements" value="F"/> NOT YET IMPLEMENTED -->
426
427   <!-- Result normalization settings -->
428
429   <set name="pz:nativesyntax" value="iso2709"/>
430   <set name="pz:xslt" value="../etc/marc21.xsl"/>
431
432 </settings>
433
434         ]]></screen>
435       </para>
436
437       <para>
438         The next example shows certain settings overriden for one target,
439         one which returns XML records containing DublinCore elements, and
440         which furthermore requires a username/password.
441         <screen><![CDATA[
442 <settings target="funkytarget.com:210/db1">
443   <set name="pz:requestsyntax" value="xml"/>
444   <set name="pz:nativesyntax" value="xml"/>
445   <set name="pz:xslt" value="../etc/dublincore.xsl"/>
446
447   <set name="pz:authentication" value="myuser/password"/>
448 </settings>
449         ]]></screen>
450       </para>
451
452       <para>
453         The following example associates a specific name/value combination
454         with a number of targets. The targets below are access-restricted,
455         and can only be used by users with special credentials.
456         <screen><![CDATA[
457 <settings name="pz:allow" value="0">
458   <set target="funkytarget.com:210/*"/>
459   <set target="commercial.com:2100/expensiveDb"/>
460 </settings>
461         ]]></screen>
462       </para>
463
464     </refsect2>
465
466     <refsect2><title>RESERVED SETTING NAMES</title>
467       <para>
468         The following setting names are reserved by pazpar2 to control the
469         behavior of the client function.
470       </para>
471
472       <variablelist>
473         <varlistentry>
474           <term>pz:cclmap:xxx</term>
475           <listitem>
476             <para>
477               This establishes a CCL field definition or other setting, for
478               the purpose of mapping end-user queries. XXX is the field or
479               setting name, and the value of the setting provides parameters
480               (e.g. parameters to send to the server, etc.). Please consult
481               the YAZ manual for a full overview of the many capabilities of
482               the powerful and flexible CCL parser.
483             </para>
484             <para>
485               Note that it is easy to etablish a set of default parameters,
486               and then override them individually for a given target.
487             </para>
488           </listitem>
489         </varlistentry>
490         <varlistentry>
491           <term>pz:requestsyntax</term>
492           <listitem>
493             <para>
494               This specifies the record syntax to use when requesting
495               records from a given server. The value can be a symbolic name like
496               marc21 or xml, or it can be a Z39.50-style dot-separated OID.
497             </para>
498           </listitem>
499         </varlistentry>
500         <varlistentry>
501           <term>pz:elements</term>
502           <listitem>
503             <para>
504               The element set name to be used when retrieving records from a
505               server.
506             </para>
507           </listitem>
508         </varlistentry>
509         <varlistentry>
510           <term>pz:piggyback</term>
511           <listitem>
512             <para>
513               Piggybacking enables the server to retrieve records from the
514               server as part of the search response in Z39.50. Almost all
515               servers support this (or fail it gracefully), but a few
516               servers will produce undesirable results.
517               Set to '1' to enable piggybacking, '0' to disable it. Default
518               is 1 (piggybacking enabled).
519             </para>
520           </listitem>
521         </varlistentry>
522         <varlistentry>
523           <term>pz:nativesyntax</term>
524           <listitem>
525             <para>
526               The representation (syntax) of the retrieval records. Currently
527               recognized values are iso2709 and xml.
528             </para>
529           </listitem>
530         </varlistentry>
531         <varlistentry>
532           <term>pz:encoding</term>
533           <listitem>
534             <para>
535               The native encoding (character set) of retrieval records. Can be anything
536               recognized by conv, but typical values are marc8 and latin1.
537               The default is UTF-8.
538             </para>
539           </listitem>
540         </varlistentry>
541         <varlistentry>
542           <term>pz:xslt</term>
543           <listitem>
544             <para>
545               Provides the path of an XSLT stylesheet which will be used to
546               map incoming records to the internal representation.
547             </para>
548           </listitem>
549         </varlistentry>
550         <varlistentry>
551           <term>pz:authentication</term>
552           <listitem>
553             <para>
554               Sets an authentication string for a given server. See the section on
555               authorization and authentication for discussion.
556             </para>
557           </listitem>
558         </varlistentry>
559         <varlistentry>
560           <term>pz:allow</term>
561           <listitem>
562             <para>
563               Allows or denies access to the resources it is applied to. Possible
564               values are '0' and '1'. The default is '1' (allow access to this resource).
565               See the manual section on authorization and authentication for discussion
566               about how to use this setting.
567             </para>
568           </listitem>
569         </varlistentry>
570         <varlistentry>
571           <term>pz:maxrecs</term>
572           <listitem>
573             <para>
574               Controls the maximum number of records to be retrieved from a
575               server. The default is 100.
576             </para>
577           </listitem>
578         </varlistentry>
579         <varlistentry>
580           <term>pz:id</term>
581           <listitem>
582             <para>
583               This setting can't be 'set' -- it contains the ID (normally
584               ZURL) for a given target, and is useful for filtering --
585               specifically when you want to select one or more specific
586               targets in the search command.
587             </para>
588           </listitem>
589         </varlistentry>
590       </variablelist>
591     </refsect2>
592
593  </refsect1>
594 </refentry>
595 <!-- Keep this comment at the end of the file
596 Local variables:
597 mode: sgml
598 sgml-omittag:t
599 sgml-shorttag:t
600 sgml-minimize-attributes:nil
601 sgml-always-quote-attributes:t
602 sgml-indent-step:1
603 sgml-indent-data:t
604 sgml-parent-document:nil
605 sgml-local-catalogs: nil
606 sgml-namecase-general:t
607 End:
608 -->