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