Reformat documentation for nxml mode.
[pazpar2-moved-to-github.git] / doc / pazpar2_conf.xml
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
3  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
4 [
5      <!ENTITY % local SYSTEM "local.ent">
6      %local;
7      <!ENTITY % entities SYSTEM "entities.ent">
8      %entities;
9      <!ENTITY % idcommon SYSTEM "common/common.ent">
10      %idcommon;
11 ]>
12 <refentry id="pazpar2_conf">
13  <refentryinfo>
14   <productname>Pazpar2</productname>
15   <productnumber>&version;</productnumber>
16   <info><orgname>Index Data</orgname></info>
17  </refentryinfo>
18  
19  <refmeta>
20   <refentrytitle>Pazpar2 conf</refentrytitle>
21   <manvolnum>5</manvolnum>
22   <refmiscinfo class="manual">File formats and conventions</refmiscinfo>
23  </refmeta>
24  
25  <refnamediv>
26   <refname>pazpar2_conf</refname>
27   <refpurpose>Pazpar2 Configuration</refpurpose>
28  </refnamediv>
29  
30  <refsynopsisdiv>
31   <cmdsynopsis>
32    <command>pazpar2.conf</command>
33   </cmdsynopsis>
34  </refsynopsisdiv>
35  
36  <refsect1>
37   <title>DESCRIPTION</title>
38   <para>
39    The Pazpar2 configuration file, together with any referenced XSLT files,
40    govern Pazpar2's behavior as a client, and control the normalization and
41    extraction of data elements from incoming result records, for the
42    purposes of merging, sorting, facet analysis, and display.
43   </para>
44   
45   <para>
46    The file is specified using the option -f on the Pazpar2 command line.
47    There is not presently a way to reload the configuration file without
48    restarting Pazpar2, although this will most likely be added some time
49    in the future.
50   </para>
51  </refsect1>
52  
53  <refsect1>
54   <title>FORMAT</title>
55   <para>
56    The configuration file is XML-structured. It must be well-formed XML. All
57    elements specific to Pazpar2 should belong to the namespace
58    <literal>http://www.indexdata.com/pazpar2/1.0</literal> 
59    (this is assumed in the
60    following examples). The root element is named "<literal>pazpar2</literal>".
61    Under the  root element are a number of elements which group categories of
62    information. The categories are described below.
63   </para>
64   
65   <refsect2 id="config-threads">
66    <title>threads</title>
67    <para>
68     This section is optional and is supported for Pazpar2 version 1.3.1 and
69     later . It is identified by element "<literal>threads</literal>" which
70     may include one attribute "<literal>number</literal>" which specifies
71     the number of worker-threads that the Pazpar2 instance is to use.
72     A value of 0 (zero) disables worker-threads (all work is carried out
73     in main thread).
74    </para>
75   </refsect2>
76   <refsect2 id="config-server">
77    <title>server</title>
78    <para>
79     This section governs overall behavior of a server endpoint. It is identified
80     by the element "server" which takes an optional attribute, "id", which
81     identifies this particular Pazpar2 server. Any string value for "id"
82     may be given.
83    </para>
84    <para>
85     The data
86     elements are described below. From Pazpar2 version 1.2 this is
87     a repeatable element.
88    </para>
89    <variablelist> <!-- level 1 -->
90     <varlistentry>
91      <term>listen</term>
92      <listitem>
93       <para>
94        Configures the webservice -- this controls how you can connect
95        to Pazpar2 from your browser or server-side code. The
96        attributes 'host' and 'port' control the binding of the
97        server. The 'host' attribute can be used to bind the server to
98        a secondary IP address of your system, enabling you to run
99        Pazpar2 on port 80 alongside a conventional web server. You
100        can override this setting on the command line using the option -h.
101       </para>
102      </listitem>
103     </varlistentry>
104     
105     <varlistentry>
106      <term>proxy</term>
107      <listitem>
108       <para>
109        If this item is given, Pazpar2 will forward all incoming HTTP
110        requests that do not contain the filename 'search.pz2' to the
111        host and port specified using the 'host' and 'port'
112        attributes. The 'myurl' attribute is required, and should provide
113        the base URL of the server. Generally, the HTTP URL for the host
114        specified in the 'listen' parameter. This functionality is
115        crucial if you wish to use
116        Pazpar2 in conjunction with browser-based code (JS, Flash,
117        applets, etc.) which operates in a security sandbox. Such code
118        can only connect to the same server from which the enclosing
119        HTML page originated. Pazpar2s proxy functionality enables you
120        to host all of the main pages (plus images, CSS, etc) of your
121        application on a conventional webserver, while efficiently
122        processing webservice requests for metasearch status, results,
123        etc.
124       </para>
125      </listitem>
126     </varlistentry>
127     
128     <varlistentry>
129      <term>relevance / sort / mergekey / facet</term>
130      <listitem>
131       <para>
132        Specifies character set normalization for relevancy / sorting /
133        mergekey and facets - for the server. These definitions serves as
134        default for services that don't have these given. For the meaning
135        of these settings refer to the "relevance" element inside service.
136       </para>
137      </listitem>
138     </varlistentry>
139     
140     <varlistentry>
141      <term>settings</term>
142      <listitem>
143       <para>
144        Specifies target settings for the server.. These settings serves
145        as default for all services which don't have these given.
146        The settings element requires one attribute 'src' which specifies
147        a settings file or a directory . If a directory is given all
148        files with suffix <filename>.xml</filename> is read from this
149        directory. Refer to 
150        <xref linkend="target_settings"/> for more information.
151       </para>
152      </listitem>
153     </varlistentry>
154     
155     <varlistentry>
156      <term>service</term>
157      <listitem>
158       <para>
159        This nested element controls the behavior of Pazpar2 with
160        respect to your data model. In Pazpar2, incoming records are
161        normalized, using XSLT, into an internal representation.
162        The 'service' section controls the further processing and
163        extraction of data from the internal representation, primarily
164        through the 'metadata' sub-element.
165       </para>
166       <para>
167        Pazpar2 version 1.2 and later allows multiple service elements.
168        Multiple services must be given a unique ID by specifying
169        attribute <literal>id</literal>.
170        A single service may be unnamed (service ID omitted). The
171        service ID is referred to in the
172        <link linkend="command-init"><literal>init</literal></link> webservice
173        command's <literal>service</literal> parameter.
174       </para>
175
176       <variablelist> <!-- Level 2 -->
177        <varlistentry>
178         <term>metadata</term>
179         <listitem>
180          <para>
181           One of these elements is required for every data element in
182           the internal representation of the record (see
183           <xref linkend="data_model"/>. It governs
184           subsequent processing as pertains to sorting, relevance
185           ranking, merging, and display of data elements. It supports
186           the following attributes:
187          </para>
188          
189          <variablelist> <!-- level 3 -->
190           <varlistentry>
191            <term>name</term>
192            <listitem>
193             <para>
194              This is the name of the data element. It is matched
195              against the 'type' attribute of the
196              'metadata' element 
197              in the normalized record. A warning is produced if
198              metadata elements with an unknown name are
199              found in the 
200              normalized record. This name is also used to
201              represent 
202              data elements in the records returned by the
203              webservice API, and to name sort lists and browse
204              facets.
205             </para>
206            </listitem>
207           </varlistentry>
208           
209           <varlistentry>
210            <term>type</term>
211            <listitem>
212             <para>
213              The type of data element. This value governs any
214              normalization or special processing that might take
215              place on an element. Possible values are 'generic'
216              (basic string), 'year' (a range is computed if
217              multiple years are found in the record). Note: This
218              list is likely to increase in the future.
219             </para>
220            </listitem>
221           </varlistentry>
222           
223           <varlistentry>
224            <term>brief</term>
225            <listitem>
226             <para>
227              If this is set to 'yes', then the data element is
228              includes in brief records in the webservice API. Note
229              that this only makes sense for metadata elements that
230              are merged (see below). The default value is 'no'.
231             </para>
232            </listitem>
233           </varlistentry>
234           
235           <varlistentry>
236            <term>sortkey</term>
237            <listitem>
238             <para>
239              Specifies that this data element is to be used for
240              sorting. The possible values are 'numeric' (numeric
241              value), 'skiparticle' (string; skip common, leading
242              articles), and 'no' (no sorting). The default value is
243              'no'.
244             </para>
245            </listitem>
246           </varlistentry>
247           
248           <varlistentry>
249            <term>rank</term>
250            <listitem>
251             <para>
252              Specifies that this element is to be used to
253              help rank 
254              records against the user's query (when ranking is
255              requested). The value is an integer, used as a
256              multiplier against the basic TF*IDF score. A value of
257              1 is the base, higher values give additional
258              weight to 
259              elements of this type. The default is '0', which
260              excludes this element from the rank calculation.
261             </para>
262            </listitem>
263           </varlistentry>
264           
265           <varlistentry>
266            <term>termlist</term>
267            <listitem>
268             <para>
269              Specifies that this element is to be used as a
270              termlist, or browse facet. Values are tabulated from
271              incoming records, and a highscore of values (with
272              their associated frequency) is made available to the
273              client through the webservice API. 
274              The possible values
275              are 'yes' and 'no' (default).
276             </para>
277            </listitem>
278           </varlistentry>
279           
280           <varlistentry>
281            <term>merge</term>
282            <listitem>
283             <para>
284              This governs whether, and how elements are extracted
285              from individual records and merged into cluster
286              records. The possible values are: 'unique' (include
287              all unique elements), 'longest' (include only the
288              longest element (strlen), 'range' (calculate a range
289              of values across all matching records), 'all' (include
290              all elements), or 'no' (don't merge; this is the
291              default);
292             </para>
293            </listitem>
294           </varlistentry>
295           
296           <varlistentry>
297            <term>mergekey</term>
298            <listitem>
299             <para>
300              If set to '<literal>required</literal>', the value of this
301              metadata element is appended to the resulting mergekey if
302              the metadata is present in a record instance.
303              If the metadata element is not present, the a unique mergekey
304              will be generated instead.
305             </para>
306             <para>
307              If set to '<literal>optional</literal>', the value of this
308              metadata element is appended to the resulting mergekey if the
309              the metadata is present in a record instance. If the metadata
310              is not present, it will be empty.
311             </para>
312             <para>
313              If set to '<literal>no</literal>' or the mergekey attribute is
314              omitted, the metadata will not be used in the creation of a
315              mergekey.
316             </para>
317            </listitem>
318           </varlistentry>
319           
320           <varlistentry>
321            <term>setting</term>
322            <listitem>
323             <para>
324              This attribute allows you to make use of static database
325              settings in the processing of records. Three possible values
326              are allowed. 'no' is the default and doesn't do anything.
327              'postproc' copies the value of a setting with the same name
328              into the output of the normalization stylesheet(s). 'parameter'
329              makes the value of a setting with the same name available 
330              as a parameter to the normalization stylesheet, so you
331              can further process the value inside of the stylesheet, or use
332              the value to decide how to deal with other data values.
333             </para>
334             <para>
335              The purpose of using settings in this way can either be to
336              control the behavior of normalization stylesheet in a database-
337              dependent way, or to easily make database-dependent values
338              available to display-logic in your user interface, without having
339              to implement complicated interactions between the user interface
340              and your configuration system.
341             </para>
342            </listitem>
343           </varlistentry>
344           
345          </variablelist> <!-- attributes to metadata -->
346          
347         </listitem>
348        </varlistentry>
349        
350        <varlistentry>
351         <term>relevance</term>
352         <listitem>
353          <para>
354           Specifies ICU tokenization and transformation rules
355           for tokens that are used in Pazpar2's relevance ranking.
356           The 'id' attribute is currently not used, and the 'locale'
357           attribute must be set to one of the locale strings
358           defined in ICU. The child elements listed below can be
359           in any order, except the 'index' element which logically
360           belongs to the end of the list. The stated tokenization,
361           transformation and charmapping instructions are performed
362           in order from top to bottom. 
363          </para>
364          <variablelist> <!-- Level 2 -->
365           <varlistentry>
366            <term>casemap</term>
367            <listitem>
368             <para>
369              The attribute 'rule' defines the direction of the
370              per-character casemapping, allowed values are "l"
371              (lower), "u" (upper), "t" (title).  
372             </para>
373            </listitem>
374           </varlistentry>
375           <varlistentry>
376            <term>transform</term>
377            <listitem>
378             <para>
379              Normalization and transformation of tokens follows
380              the rules defined in the 'rule' attribute. For
381              possible values we refer to the extensive ICU
382              documentation found at the 
383              <ulink url="&url.icu.transform;">ICU
384              transformation</ulink> home page. Set filtering
385              principles are explained at the 
386              <ulink url="&url.icu.unicode.set;">ICU set and
387              filtering</ulink> page.
388             </para>
389            </listitem>
390           </varlistentry>
391           <varlistentry>
392            <term>tokenize</term>
393            <listitem>
394             <para>
395              Tokenization is the only rule in the ICU chain
396              which splits one token into multiple tokens. The
397              'rule' attribute may have the following values:
398              "s" (sentence), "l" (line-break), "w" (word), and
399              "c" (character), the later probably not being
400              very useful in a pruning Pazpar2 installation. 
401             </para>
402            </listitem>
403           </varlistentry>
404          </variablelist>
405          <para>
406           From Pazpar2 version 1.1 the ICU wrapper from YAZ is used.
407           Refer to the <ulink url="&url.yaz.yaz-icu;">yaz-icu</ulink>
408           utility for more information.
409          </para>
410         </listitem>
411        </varlistentry>
412        
413        <varlistentry>
414         <term>sort</term>
415         <listitem>
416          <para>
417           Specifies ICU tokenization and transformation rules
418           for tokens that are used in Pazpar2's sorting. The contents
419           is similar to that of <literal>relevance</literal>.
420          </para>
421         </listitem>
422        </varlistentry>
423        
424        <varlistentry>
425         <term>mergekey</term>
426         <listitem>
427          <para>
428           Specifies ICU tokenization and transformation rules
429           for tokens that are used in Pazpar2's mergekey. The contents
430           is similar to that of <literal>relevance</literal>.
431          </para>
432         </listitem>
433        </varlistentry>
434
435        <varlistentry>
436         <term>facet</term>
437         <listitem>
438          <para>
439           Specifies ICU tokenization and transformation rules
440           for tokens that are used in Pazpar2's facets. The contents
441           is similar to that of <literal>relevance</literal>.
442          </para>
443         </listitem>
444        </varlistentry>
445        
446        <varlistentry>
447         <term>settings</term>
448         <listitem>
449          <para>
450           Specifies target settings for this service. Refer to
451           <xref linkend="target_settings"/>.
452          </para>
453         </listitem>
454        </varlistentry>
455
456        <varlistentry>
457         <term>timeout</term>
458         <listitem>
459          <para>
460           Specifies timeout parameters for this service.
461           The <literal>timeout</literal>
462           element supports the following attributes: 
463           <literal>session</literal>, <literal>z3950_operation</literal>,
464           <literal>z3950_session</literal> which specifies
465           'session timeout', 'Z39.50 operation timeout',
466           'Z39.50 session timeout' respectively. The Z39.50 operation
467           timeout is the time Pazpar2 will wait for an active Z39.50/SRU
468           operation before it gives up (times out). The Z39.50 session
469           time out is the time Pazpar2 will keep the session alive for
470           an idle session (no operation).
471          </para>
472          <para>
473           The following is recommended but not required:
474           z3950_operation (30) &lt; session (60) &lt; z3950_session (180) .
475           The default values are given in parantheses.
476          </para>
477         </listitem>
478        </varlistentry>
479       </variablelist>     <!-- Data elements in service directive -->
480      </listitem>
481     </varlistentry>
482    </variablelist>           <!-- Data elements in server directive -->
483   </refsect2>
484  </refsect1>
485
486  <refsect1>
487   <title>EXAMPLE</title>
488   <para>
489    Below is a working example configuration:
490   </para>
491   <screen>
492    <![CDATA[
493 <?xml version="1.0" encoding="UTF-8"?>
494 <pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
495
496  <threads number="10"/>
497  <server>
498   <listen port="9004"/>
499   <service>
500    <metadata name="title" brief="yes" sortkey="skiparticle"
501              merge="longest" rank="6"/>
502    <metadata name="isbn" merge="unique"/>
503    <metadata name="date" brief="yes" sortkey="numeric"
504              type="year" merge="range" termlist="yes"/>
505    <metadata name="author" brief="yes" termlist="yes"
506              merge="longest" rank="2"/>
507    <metadata name="subject" merge="unique" termlist="yes" rank="3"/>
508    <metadata name="url" merge="unique"/>
509    <relevance>
510     <icu_chain id="relevance" locale="el">
511      <transform rule="[:Control:] Any-Remove"/>
512      <tokenize rule="l"/>
513      <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
514      <casemap rule="l"/>
515     </icu_chain>
516    </relevance>
517    <settings src="mysettings"/>
518    <timeout session="60"/>
519   <service>
520  </server>
521 </pazpar2>
522    ]]>
523   </screen>
524  </refsect1> 
525
526  <refsect1 id="config-include">
527   <title>INCLUDE FACILITY</title>
528   <para>
529    The XML configuration may be partitioned into multiple files by using
530    the <literal>include</literal> element which takes a single attribute,
531    <literal>src</literal>. The of the <literal>src</literal> attribute is
532    regular Shell like glob-pattern. For example,
533    <screen><![CDATA[
534    <include src="/etc/pazpar2/conf.d/*.xml"/>
535    ]]></screen>
536   </para>
537   <para>
538    The include facility requires Pazpar2 version 1.2.
539   </para>
540  </refsect1>
541
542  <refsect1 id="target_settings">
543   <title>TARGET SETTINGS</title>
544   <para>
545    Pazpar2 features a cunning scheme by which you can associate various
546    kinds of attributes, or settings with search targets. This can be done
547    through XML files which are read at startup; each file can associate
548    one or more settings with one or more targets. The file format is generic
549    in nature, designed to support a wide range of application requirements. The
550    settings can be purely technical things, like, how to perform a title
551    search against a given target, or it can associate arbitrary name=value
552    pairs with groups of targets -- for instance, if you would like to
553    place all commercial full-text bases in one group for selection
554    purposes, or you would like to control what targets are accessible
555    to users by default. Per-database settings values can even be used
556    to drive sorting, facet/termlist generation, or end-user interface display
557    logic.
558   </para>
559   
560   <para>
561    During startup, Pazpar2 will recursively read a specified directory
562    (can be identified in the pazpar2.cfg file or on the command line), and
563    process any settings files found therein.
564   </para>
565   
566   <para>
567    Clients of the Pazpar2 webservice interface can selectively override
568    settings for individual targets within the scope of one session. This
569    can be used in conjunction with an external authentication system to
570    determine which resources are to be accessible to which users. Pazpar2
571    itself has no notion of end-users, and so can be used in conjunction
572    with any type of authentication system. Similarly, the authentication
573    tokens submitted to access-controlled search targets can similarly be
574    overridden, to allow use of Pazpar2 in a consortial or multi-library
575    environment, where different end-users may need to be represented to
576    some search targets in different ways. This, again, can be managed
577    using an external database or other lookup mechanism. Setting overrides
578    can be performed either using the
579    <link linkend="command-init">init</link> or the 
580    <link linkend="command-settings">settings</link> webservice
581    command.
582   </para>
583   
584   <para>
585    In fact, every setting that applies to a database (except pz:id, which
586    can only be used for filtering targets to use for a search) can be overridden
587    on a per-session basis. This allows the client to override specific CCL fields
588    for searching, etc., to meet the needs of a session or user.
589   </para>
590
591   <para>
592    Finally, as an extreme case of this, the webservice client can
593    introduce entirely new targets, on the fly, as part of the
594    <link linkend="command-init">init</link> or
595    <link linkend="command-settings">settings</link> command.
596    This is useful if you desire to manage information
597    about your search targets in a separate application such as a database.
598    You do not need any static settings file whatsoever to run Pazpar2 -- as
599    long as the webservice client is prepared to supply the necessary
600    information at the beginning of every session.
601   </para>
602
603   <note>
604    <para>
605     The following discussion of practical issues related to session and settings
606     management are cast in terms of a user interface based on Ajax/Javascript
607     technology. It would apply equally well to many other kinds of browser-based logic.
608    </para>
609   </note>
610
611   <para>
612    Typically, a Javascript client is not allowed to  directly alter the parameters
613    of a session. There are two reasons for this. One has to do with access
614    to information; typically, information about a user will be stored in a
615    system on the server side, or it will be accessible in some way from the server.
616    However, since the Javascript client cannot be entirely trusted (some hostile
617    agent might in fact 'pretend' to be a regular ws client), it is more robust
618    to control session settings from scripting that you run as part of your
619    webserver. Typically, this can be handled during the session initialization,
620    as follows:
621   </para>
622
623   <para>
624    Step 1: The Javascript client loads, and asks the webserver for a new Pazpar2
625    session ID. This can be done using a Javascript call, for instance. Note that
626    it is possible to submit Ajax HTTPXmlRequest calls either to Pazpar2 or to the
627    webserver that Pazpar2 is proxying for. See (XXX Insert link to Pazpar2 protocol).
628   </para>
629
630   <para>
631    Step 2: Code on the webserver authenticates the user, by database lookup,
632    LDAP access, NCIP, etc. Determines which resources the user has access to,
633    and any user-specific parameters that are to be applied during this session.
634   </para>
635
636   <para>
637    Step 3: The webserver initializes a new Pazpar2 settings, and sets user-specific
638    parameters as necessary, using the init webservice command. A new session ID is
639    returned.
640   </para>
641
642   <para>
643    Step 4: The webserver returns this session ID to the Javascript client, which then
644    uses the session ID to submit searches, show results, etc.
645   </para>
646
647   <para>
648    Step 5: When the Javascript client ceases to use the session, Pazpar2 destroys
649    any session-specific information.
650   </para>
651
652   <refsect2>
653    <title>SETTINGS FILE FORMAT</title>
654    <para>
655     Each file contains a root element named &lt;settings&gt;. It may
656     contain one or more &lt;set&gt; elements. The settings and set
657     elements may contain the following attributes. Attributes in the set node
658     overrides those in the setting root element. Each set node must
659     specify (directly, or inherited from the parent node) at least a
660     target, name, and value.
661    </para>
662
663    <variablelist> 
664     <varlistentry>
665      <term>target</term>
666      <listitem>
667       <para>
668        This specifies the search target to which this setting should be
669        applied. Targets are identified by their Z39.50 URL, generally
670        including the host, port, and database name, (e.g.
671        <literal>bagel.indexdata.com:210/marc</literal>).
672        Two wildcard forms are accepted:
673        * (asterisk) matches all known targets;
674        <literal>bagel.indexdata.com:210/*</literal> matches all
675        known databases on the given host.
676       </para>
677       <para>
678        A precedence system determines what happens if there are
679        overlapping values for the same setting name for the same
680        target. A setting for a specific target name overrides a
681        setting which specifies target using a wildcard. This makes it
682        easy to set defaults for all targets, and then override them
683        for specific targets or hosts. If there are
684        multiple overlapping settings with the same name and target
685        value, the 'precedence' attribute determines what happens.
686       </para>
687      </listitem>
688     </varlistentry>
689     <varlistentry>
690      <term>name</term>
691      <listitem>
692       <para>
693        The name of the setting. This can be anything you like.
694        However, Pazpar2 reserves a number of setting names for
695        specific purposes, all starting with 'pz:', and it is a good
696        idea to avoid that prefix if you make up your own setting
697        names. See below for a list of reserved variables.
698       </para>
699      </listitem>
700     </varlistentry>
701     <varlistentry>
702      <term>value</term>
703      <listitem>
704       <para>
705        The value of the setting. Generally, this can be anything you
706        want -- however, some of the reserved settings may expect
707        specific kinds of values.
708       </para>
709      </listitem>
710     </varlistentry>
711     <varlistentry>
712      <term>precedence</term>
713      <listitem>
714       <para>
715        This should be an integer. If not provided, the default value
716        is 0. If two (or more) settings have the same content for
717        target and name, the precedence value determines the outcome.
718        If both settings have the same precedence value, they are both
719        applied to the target(s). If one has a higher value, then the
720        value of that setting is applied, and the other one is ignored.
721       </para>
722      </listitem>
723     </varlistentry>
724    </variablelist>
725
726    <para>
727     By setting defaults for target, name, or value in the root
728     settings node, you can use the settings files in many different
729     ways. For instance, you can use a single file to set defaults for
730     many different settings, like search fields, retrieval syntaxes,
731     etc. You can have one file per server, which groups settings for
732     that server or target. You could also have one file which associates
733     a number of targets with a given setting, for instance, to associate
734     many databases with a given category or class that makes sense
735     within your application.
736    </para>
737
738    <para>
739     The following examples illustrate uses of the settings system to
740     associate settings with targets to meet different requirements.
741    </para>
742
743    <para>
744     The example below associates a set of default values that can be
745     used across many targets. Note the wildcard for targets.
746     This associates the given settings with all targets for which no
747     other information is provided.
748     <screen><![CDATA[
749     <settings target="*">
750
751     <!-- This file introduces default settings for pazpar2 -->
752
753     <!-- mapping for unqualified search -->
754     <set name="pz:cclmap:term" value="u=1016 t=l,r s=al"/>
755
756     <!-- field-specific mappings -->
757     <set name="pz:cclmap:ti" value="u=4 s=al"/>
758     <set name="pz:cclmap:su" value="u=21 s=al"/>
759     <set name="pz:cclmap:isbn" value="u=7"/>
760     <set name="pz:cclmap:issn" value="u=8"/>
761     <set name="pz:cclmap:date" value="u=30 r=r"/>
762     
763     <set name="pz:limitmap:title" value="rpn:@attr 1=4 @attr 6=3"/>
764     <set name="pz:limitmap:date" value="ccl:date"/>
765
766     <!-- Retrieval settings -->
767
768     <set name="pz:requestsyntax" value="marc21"/>
769     <set name="pz:elements" value="F"/>
770
771     <!-- Query encoding -->
772     <set name="pz:queryencoding" value="iso-8859-1"/>
773
774     <!-- Result normalization settings -->
775
776     <set name="pz:nativesyntax" value="iso2709"/>
777     <set name="pz:xslt" value="../etc/marc21.xsl"/>
778
779     </settings>
780
781     ]]></screen>
782    </para>
783
784    <para>
785     The next example shows certain settings overridden for one target,
786     one which returns XML records containing DublinCore elements, and
787     which furthermore requires a username/password.
788     <screen><![CDATA[
789     <settings target="funkytarget.com:210/db1">
790     <set name="pz:requestsyntax" value="xml"/>
791     <set name="pz:nativesyntax" value="xml"/>
792     <set name="pz:xslt" value="../etc/dublincore.xsl"/>
793
794     <set name="pz:authentication" value="myuser/password"/>
795     </settings>
796     ]]></screen>
797    </para>
798
799    <para>
800     The following example associates a specific name/value combination
801     with a number of targets. The targets below are access-restricted,
802     and can only be used by users with special credentials.
803     <screen><![CDATA[
804     <settings name="pz:allow" value="0">
805     <set target="funkytarget.com:210/*"/>
806     <set target="commercial.com:2100/expensiveDb"/>
807     </settings>
808     ]]></screen>
809    </para>
810
811   </refsect2>
812
813   <refsect2>
814    <title>RESERVED SETTING NAMES</title>
815    <para>
816     The following setting names are reserved by Pazpar2 to control the
817     behavior of the client function.
818    </para>
819    
820    <variablelist>
821     <varlistentry>
822      <term>pz:cclmap:xxx</term>
823      <listitem>
824       <para>
825        This establishes a CCL field definition or other setting, for
826        the purpose of mapping end-user queries. XXX is the field or
827        setting name, and the value of the setting provides parameters
828        (e.g. parameters to send to the server, etc.). Please consult
829        the YAZ manual for a full overview of the many capabilities of
830        the powerful and flexible CCL parser.
831       </para>
832       <para>
833        Note that it is easy to establish a set of default parameters,
834        and then override them individually for a given target.
835       </para>
836      </listitem>
837     </varlistentry>
838     <varlistentry id="requestsyntax">
839      <term>pz:requestsyntax</term>
840      <listitem>
841       <para>
842        This specifies the record syntax to use when requesting
843        records from a given server. The value can be a symbolic name like
844        marc21 or xml, or it can be a Z39.50-style dot-separated OID.
845       </para>
846      </listitem>
847     </varlistentry>
848     <varlistentry>
849      <term>pz:elements</term>
850      <listitem>
851       <para>
852        The element set name to be used when retrieving records from a
853        server.
854       </para>
855      </listitem>
856     </varlistentry>
857     <varlistentry>
858      <term>pz:piggyback</term>
859      <listitem>
860       <para>
861        Piggybacking enables the server to retrieve records from the
862        server as part of the search response in Z39.50. Almost all
863        servers support this (or fail it gracefully), but a few
864        servers will produce undesirable results.
865        Set to '1' to enable piggybacking, '0' to disable it. Default
866        is 1 (piggybacking enabled).
867       </para>
868      </listitem>
869     </varlistentry>
870     <varlistentry>
871      <term>pz:nativesyntax</term>
872      <listitem>
873       <para>
874        Specifies how Pazpar2 shoule map retrieved records to XML. Currently
875        supported values are <literal>xml</literal>,
876        <literal>iso2709</literal> and <literal>txml</literal>.
877       </para>
878       <para>
879        The value <literal>iso2709</literal> makes Pazpar2 convert retrieved
880        MARC records to MARCXML. In order to convert to XML, the exact
881        chacater set of the MARC must be known (if not, the resulting
882        XML is probably not well-formed). The character set may be 
883        specified by adding:
884        <literal>;charset=</literal><replaceable>charset</replaceable> to
885        <literal>iso2709</literal>. If omitted, a charset of
886        MARC-8 is assumed. This is correct for most MARC21/USMARC records.
887       </para>
888       <para>
889        The value <literal>txml</literal> is like <literal>iso2709</literal>
890        except that records are converted to TurboMARC instead of MARCXML.
891       </para>
892       <para>
893        The value <literal>xml</literal> is used if Pazpar2 retrieves
894        records that are already XML (no conversion takes place).
895       </para>
896      </listitem>
897     </varlistentry>
898
899     <varlistentry>
900      <term>pz:queryencoding</term>
901      <listitem>
902       <para>
903        The encoding of the search terms that a target accepts. Most
904        targets do not honor UTF-8 in which case this needs to be specified.
905        Each term in a query will be converted if this setting is given.
906       </para>
907      </listitem>
908     </varlistentry>
909
910     <varlistentry>
911      <term>pz:negotiation_charset</term>
912      <listitem>
913       <para>
914        Sets character set for Z39.50 negotiation. Most targets do not support
915        this, and some will even close connection if set (crash on server
916        side or similar). If set, you probably want to set it to
917        <literal>UTF-8</literal>.
918       </para>
919      </listitem>
920     </varlistentry>
921
922     <varlistentry>
923      <term>pz:xslt</term>
924      <listitem>
925       <para>
926        Is a comma separated list of of files that specifies
927        how to convert incoming records to the internal representation.
928       </para>
929       <para>
930        The suffix of each file specifies the kind of tranformation.
931        Suffix "<literal>.xsl</literal>" makes an XSL transform. Suffix
932        "<literal>.mmap</literal>" will use the MMAP transform (described below).
933       </para>
934       <para>
935        The special value "<literal>auto</literal>" will use a file
936        which is the <link linkend="requestsyntax">pz:requestsyntax's</link>
937        value followed by
938        <literal>'.xsl'</literal>.
939       </para>
940       <para>
941        When mapping MARC records, XSLT can be bypassed for increased 
942        performance with the alternate "MARC map" format.  Provide the
943        path of a file with extension ".mmap" containing on each line:
944        <programlisting>
945        &lt;field&gt; &lt;subfield&gt; &lt;metadata element&gt;</programlisting>
946        For example:
947        <programlisting>
948         245 a title
949         500 $ description
950         773 * citation
951        </programlisting>
952        To map the field value specify a subfield of '$'.  To store a 
953        concatenation of all subfields, specify a subfield of '*'.
954       </para>
955      </listitem>
956     </varlistentry>
957     <varlistentry>
958      <term>pz:authentication</term>
959      <listitem>
960       <para>
961        Sets an authentication string for a given server. See the section on
962        authorization and authentication for discussion.
963       </para>
964      </listitem>
965     </varlistentry>
966     <varlistentry>
967      <term>pz:allow</term>
968      <listitem>
969       <para>
970        Allows or denies access to the resources it is applied to. Possible
971        values are '0' and '1'.
972        The default is '1' (allow access to this resource).
973        See the manual section on authorization and authentication for
974        discussion about how to use this setting.
975       </para>
976      </listitem>
977     </varlistentry>
978     <varlistentry>
979      <term>pz:maxrecs</term>
980      <listitem>
981       <para>
982        Controls the maximum number of records to be retrieved from a
983        server. The default is 100.
984       </para>
985      </listitem>
986     </varlistentry>
987     <varlistentry>
988      <term>pz:id</term>
989      <listitem>
990       <para>
991        This setting can't be 'set' -- it contains the ID (normally
992        ZURL) for a given target, and is useful for filtering --
993        specifically when you want to select one or more specific
994        targets in the search command.
995       </para>
996      </listitem>
997     </varlistentry>
998     <varlistentry>
999      <term>pz:zproxy</term>
1000      <listitem>
1001       <para>
1002        The 'pz:zproxy' setting has the value syntax 
1003        'host.internet.adress:port', it is used to tunnel Z39.50
1004        requests through the named Z39.50 proxy.
1005       </para>
1006      </listitem>
1007     </varlistentry>
1008     
1009     <varlistentry>
1010      <term>pz:apdulog</term>
1011      <listitem>
1012       <para>
1013        If the 'pz:apdulog' setting is defined and has other value than 0,
1014        then Z39.50 APDUs are written to the log.
1015       </para>
1016      </listitem>
1017     </varlistentry>
1018     
1019     <varlistentry>
1020      <term>pz:sru</term>
1021      <listitem>
1022       <para>
1023        This setting enables
1024        <ulink url="&url.sru;">SRU</ulink>/<ulink url="&url.solr;">SOLR</ulink>
1025        support.
1026        It has four possible settings.
1027        'get', enables SRU access through GET requests. 'post' enables SRU/POST
1028        support, less commonly supported, but useful if very large requests are
1029        to be submitted. 'srw' enables the SRW (SRU over SOAP) variation of
1030        the protocol.
1031       </para>
1032       <para>
1033        A value of 'solr' anables SOLR client support. This is supported
1034        for Pazpar version 1.5.0 and later.
1035       </para>
1036      </listitem>
1037     </varlistentry>
1038     
1039     <varlistentry>
1040      <term>pz:sru_version</term>
1041      <listitem>
1042       <para>
1043        This allows SRU version to be specified. If unset Pazpar2
1044        will the default of YAZ (currently 1.2). Should be set
1045        to 1.1 or 1.2. For SOLR, the current supported/tested version is 1.4
1046       </para>
1047      </listitem>
1048     </varlistentry>
1049     
1050     <varlistentry>
1051      <term>pz:pqf_prefix</term>
1052      <listitem>
1053       <para>
1054        Allows you to specify an arbitrary PQF query language substring.
1055        The provided string is prefixed the user's query after it has been
1056        normalized to PQF internally in pazpar2.
1057        This allows you to attach complex 'filters' to queries for a given
1058        target, sometimes necessary to select sub-catalogs
1059        in union catalog systems, etc.
1060       </para>
1061      </listitem>
1062     </varlistentry>
1063     
1064     <varlistentry>
1065      <term>pz:pqf_strftime</term>
1066      <listitem>
1067       <para>
1068        Allows you to extend a query with dates and operators.
1069        The provided string allows certain substitutions and serves as a
1070        format string.
1071        The special two character sequence '%%' gets converted to the
1072        original query. Other characters leading with the percent sign are
1073        conversions supported by strftime.
1074        All other characters are copied verbatim. For example, the string
1075        <literal>@and @attr 1=30 @attr 2=3 %Y %%</literal>
1076        would search for current year combined with the original PQF (%%).
1077       </para>
1078      </listitem>
1079     </varlistentry>
1080     
1081     <varlistentry>
1082      <term>pz:sort</term>
1083      <listitem>
1084       <para>
1085        Specifies sort criteria to be applied to the result set.
1086        Only works for targets which support the sort service.
1087       </para>
1088      </listitem>
1089     </varlistentry>
1090
1091     <varlistentry>
1092      <term>pz:recordfilter</term>
1093      <listitem>
1094       <para>
1095        Specifies a filter which allows Pazpar2 to only include
1096        records that meet a certain criteria in a result. Unmatched records
1097        will be ignored. The filter takes the form name, name~value, or name=value, which
1098        will include only records with metadata element (name) that has the
1099        substring (~value) given, or matches exactly (=value). If value is omitted all records
1100        with the named
1101        metadata element present will be included.
1102       </para>
1103      </listitem>
1104     </varlistentry>
1105     
1106     <varlistentry>
1107      <term>pz:preferred</term>
1108      <listitem>
1109       <para>
1110        Specifies that a target is preferred, e.g. possible local, faster target. Using block=pref on show command  
1111        will wait for all these targets to return records before releasing the block. If no target is preferred, 
1112        the block=pref will identical to block=1, which release when one target has returned records.     
1113       </para>
1114      </listitem>
1115     </varlistentry>
1116
1117     <varlistentry>
1118      <term>pz:block_timeout</term>
1119      <listitem>
1120       <para>
1121        (Not yet implemented). Specifies the time for which a block should be released anyway.      
1122       </para>
1123      </listitem>
1124     </varlistentry>
1125
1126     <varlistentry>
1127      <term>pz:facetmap:<replaceable>name</replaceable></term>
1128      <listitem>
1129       <para>
1130        Specifies that for field <replaceable>name</replaceable>, the target
1131        supports (native) facets. The value is the name of the
1132        field on the target.
1133       </para>
1134       <note>
1135        <para>
1136         At this point only SOLR targets have been tested with this
1137         facility.
1138        </para>
1139       </note>
1140      </listitem>
1141     </varlistentry>
1142
1143     <varlistentry>
1144      <term>pz:limitmap:<replaceable>name</replaceable></term>
1145      <listitem>
1146       <para>
1147        Specifies attributes for limiting a search to a field - using
1148        the limit parameter for search. In some cases the mapping of 
1149        a field to a value is identical to an existing cclmap field; in
1150        other cases the field must be specified in a different way - for
1151        example to match a complete field (rather than parts of a subfield).
1152       </para>
1153       <para>
1154        The value of limitmap may have one of two forms: referral to
1155        an exisiting CCL field or a raw PQF string. Leading string
1156        determines type; either <literal>ccl:</literal> for CCL field or
1157        <literal>rpn:</literal> for PQF/RPN.
1158       </para>
1159       <note>
1160        <para>
1161         The limitmap facility is supported for Pazpar2 version 1.6.0.
1162        </para>
1163       </note>
1164      </listitem>
1165     </varlistentry>
1166     
1167    </variablelist>
1168
1169   </refsect2>
1170
1171  </refsect1>
1172  <refsect1>
1173   <title>SEE ALSO</title>
1174   <para>
1175    <citerefentry>
1176     <refentrytitle>pazpar2</refentrytitle>
1177     <manvolnum>8</manvolnum>
1178    </citerefentry>
1179    <citerefentry>
1180     <refentrytitle>yaz-icu</refentrytitle>
1181     <manvolnum>1</manvolnum>
1182    </citerefentry>
1183    <citerefentry>
1184     <refentrytitle>pazpar2_protocol</refentrytitle>
1185     <manvolnum>7</manvolnum>
1186    </citerefentry>
1187   </para>
1188  </refsect1>
1189 </refentry>
1190 <!-- Keep this comment at the end of the file
1191 Local variables:
1192 mode: nxml
1193 nxml-child-indent: 1
1194 End:
1195 -->