Pazpar2 1.4.4-2 for squeeze
[pazpar2-moved-to-github.git] / doc / book.xml
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN"
3     "http://www.oasis-open.org/docbook/xml/4.1/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 <book id="book">
13  <bookinfo>
14   <title>Pazpar2 - User's Guide and Reference</title>
15   <author>
16    <firstname>Sebastian</firstname><surname>Hammer</surname>
17   </author>
18   <author>
19    <firstname>Adam</firstname><surname>Dickmeiss</surname>
20   </author>
21   <author>
22    <firstname>Marc</firstname><surname>Cromme</surname>
23   </author>
24   <author>
25    <firstname>Jakub</firstname><surname>Skoczen</surname>
26   </author>
27   <author>
28    <firstname>Mike</firstname><surname>Taylor</surname>
29   </author>
30   <releaseinfo>&version;</releaseinfo>
31   <copyright>
32    <year>&copyright-year;</year>
33    <holder>Index Data</holder>
34   </copyright>
35   <abstract>
36    <simpara>
37     Pazpar2 is a high-performance metasearch engine featuring
38     merging, relevance ranking, record sorting,
39     and faceted results.
40     It is middleware: it has no user interface of its own, but can be
41     configured and controlled by an XML-over-HTTP web-service to provide
42     metasearching functionality behind any user interface.
43    </simpara>
44    <simpara>
45     This document is a guide and reference to Pazpar2 version &version;.
46    </simpara>
47    <simpara>
48     <inlinemediaobject>
49      <imageobject>
50       <imagedata fileref="common/id.png" format="PNG"/>
51    </imageobject>
52     <imageobject>
53      <imagedata fileref="common/id.eps" format="EPS"/>
54    </imageobject>
55    </inlinemediaobject>
56    </simpara>
57   </abstract>
58  </bookinfo>
59  
60  <chapter id="introduction">
61   <title>Introduction</title>
62
63   <section id="what.pazpar2.is">
64   <title>What Pazpar2 is</title>
65   <para>
66    Pazpar2 is a stand-alone metasearch engine with a web-service API, designed
67    to be used either from a browser-based client (JavaScript, Flash,
68    Java applet,
69    etc.), from server-side code, or any combination of the two.
70    Pazpar2 is a highly optimized client designed to
71    search many resources in parallel. It implements record merging,
72    relevance-ranking and sorting by arbitrary data content, and facet
73    analysis for browsing purposes. It is designed to be data-model
74    independent, and is capable of working with MARC, DublinCore, or any
75    other <ulink url="&url.xml;">XML</ulink>-structured response format
76    -- <ulink url="&url.xslt;">XSLT</ulink> is used to normalize and extract
77    data from retrieval records for display and analysis. It can be used
78    against any server which supports the 
79    <ulink url="&url.z39.50;">Z39.50</ulink> or <ulink url="&url.sru;">SRU/SRW</ulink>
80    protocol. Proprietary
81    backend modules can function as connectors between these standard
82    protocols and any non-standard API, including web-site scraping, to
83    support a large number of other protocols.
84   </para>
85   <para>
86    Additional functionality such as
87    user management and attractive displays are expected to be implemented by
88    applications that use Pazpar2. Pazpar2 itself is user-interface independent.
89    Its functionality is exposed through a simple XML-based web-service API,
90    designed to be easy to use from an Ajax-enabled browser, Flash
91    animation, Java applet, etc., or from a higher-level server-side language
92    like PHP, Perl or Java. Because session information can be shared between
93    browser-based logic and server-side scripting, there is tremendous
94    flexibility in how you implement application-specific logic on top
95    of Pazpar2.
96   </para>
97   <para>
98    Once you launch a search in Pazpar2, the operation continues behind the
99    scenes. Pazpar2 connects to servers, carries out searches, and
100    retrieves, deduplicates, and stores results internally. Your application
101    code may periodically inquire about the status of an ongoing operation,
102    and ask to see records or result set facets. Results become
103    available immediately, and it is easy to build end-user interfaces than
104    feel extremely responsive, even when searching more than 100 servers
105    concurrently.
106   </para>
107   <para>
108    Pazpar2 is designed to be highly configurable. Incoming records are
109    normalized to XML/UTF-8, and then further normalized using XSLT to a
110    simple internal representation that is suitable for analysis. By
111    providing XSLT stylesheets for different kinds of result records, you
112    can configure Pazpar2 to work against different kinds of information
113    retrieval servers. Finally, metadata is extracted in a configurable
114    way from this internal record, to support display, merging, ranking,
115    result set facets, and sorting. Pazpar2 is not bound to a specific model
116    of metadata, such as DublinCore or MARC: by providing the right
117    configuration, it can work with any combination of different kinds of data in
118    support of many different applications.
119   </para>
120   <para>
121    Pazpar2 is designed to be efficient and scalable. You can set it up to
122    search several hundred targets in parallel, or you can use it to support
123    hundreds of concurrent users. It is implemented with the same attention
124    to performance and economy that we use in our indexing engines, so that
125    you can focus on building your application without worrying about the
126    details of metasearch logic. You can devote all of your attention to
127    usability and let Pazpar2 do what it does best -- metasearch.
128   </para>
129   <para>
130    Pazpar2 is our attempt to re-think the traditional paradigms for
131    implementing and deploying metasearch logic, with an uncompromising
132    approach to performance, and attempting to make maximum use of the
133    capabilities of modern browsers. The demo user interface that
134    accompanies the distribution is but one example. If you think of new
135    ways of using Pazpar2, we hope you'll share them with us, and if we
136    can provide assistance with regards to training, design, programming,
137    integration with different backends, hosting, or support, please don't
138    hesitate to contact us. If you'd like to see functionality in Pazpar2
139    that is not there today, please don't hesitate to contact us. It may
140    already be in our development pipeline, or there might be a
141    possibility for you to help out by sponsoring development time or
142    code. Either way, get in touch and we will give you straight answers.
143   </para>
144   <para>
145    Enjoy!
146   </para>
147   <para>
148    Pazpar2 is covered by the GNU General Public License (GPL) version 2.
149    See <xref linkend="license"/> for further information.
150   </para>
151   </section>
152
153   <section id="connectors">
154   <title>Connectors to non-standard databases</title>
155   <para>
156    If you wish to connect to commercial or other databases which do not
157    support open standards, please contact Index Data on
158    <email>info@indexdata.com</email>. We have a
159    proprietary framework for building connectors that enable Pazpar2
160    to access
161    thousands of online databases, in addition to the vast number of catalogs
162    and online services that support the Z39.50/SRU/SRW protocols.
163   </para>
164   </section>
165
166   <section id="name">
167    <title>A note on the name Pazpar2</title>
168    <para>
169     The name Pazpar2 derives from three sources.  One one hand, it is
170     Index Data's second major piece of software that does parallel
171     searching of Z39.50 targets.  On the other, it is a near-homophone
172     of Passpartout, the ever-helpful servant in Jules Verne's novel
173     Around the World in Eighty Days (who helpfully uses the language
174     of his master).  Finally, "passe par tout" means something like
175     "passes through anything" in French -- on other words, a universal
176     solution, or if you like a MasterKey.
177    </para>
178   </section>
179  </chapter>
180
181  <chapter id="installation">
182   <title>Installation</title>
183   <para>
184    The Pazpar2 package includes documentation as well
185    as the Pazpar2 server. The package also includes a simple user
186    interface called "test1", which consists of a single HTML page and a single
187    JavaScript file to illustrate the use of Pazpar2.
188   </para>
189   <para>
190    Pazpar2 depends on the following tools/libraries:
191    <variablelist>
192     <varlistentry><term><ulink url="&url.yaz;">YAZ</ulink></term>
193      <listitem>
194       <para>
195        The popular Z39.50 toolkit for the C language.
196        YAZ <emphasis>must</emphasis> be compiled with Libxml2/Libxslt support.
197       </para>
198      </listitem>
199     </varlistentry>
200     <varlistentry><term><ulink url="&url.icu;">International
201        Components for Unicode (ICU)</ulink></term>
202      <listitem>
203       <para>
204        ICU provides Unicode support for non-English languages with
205        character sets outside the range of 7bit ASCII, like
206        Greek, Russian, German and French. Pazpar2 uses the ICU
207        Unicode character conversions, Unicode normalization, case
208        folding and other fundamental operations needed in
209        tokenization, normalization and ranking of records. 
210       </para>
211       <para>
212        Compiling, linking, and usage of the ICU libraries is optional,
213        but strongly recommended for usage in an international
214        environment.  
215       </para>
216      </listitem>
217     </varlistentry>
218    </variablelist>
219   </para>
220   <para>
221    In order to compile Pazpar2, a C compiler which supports C99 or later
222    is required.
223   </para>
224
225   <section id="installation.unix">
226    <title>Installation from source on Unix (including Linux, MacOS, etc.)</title>
227    <para>
228     The latest source code for Pazpar2 is available from
229     <ulink url="&url.pazpar2.download;"/>.
230     Most Unix-based operating systems have the required
231     tools available as binary packages.
232     For example, if Libxml2/libXSLT libraries
233     are already installed as development packages, use these.
234    </para>
235    
236    <para>
237     Ensure that the development libraries and header files are
238     available on your system before compiling Pazpar2. For installation
239     of YAZ, refer to the Installation chapter of the YAZ manual at
240     <ulink url="&url.yaz.install;"/>.
241    </para>
242    <para>
243     Once the dependencies are in place, Pazpar2 can be unpacked and
244     installed as follows:
245    </para>
246    <screen>
247     tar xzf pazpar2-VERSION.tar.gz
248     cd pazpar2-VERSION
249     ./configure
250     make
251     sudo make install
252    </screen>
253    <para>
254     The <literal>make install</literal> will install manpages as well as the
255     Pazpar2 server, <literal>pazpar2</literal>, 
256     in PREFIX<literal>/sbin</literal>.
257     By default, PREFIX is <literal>/usr/local/</literal> . This can be
258     changed with configure option <option>--prefix</option>.
259    </para>
260   </section>
261
262   <section id="installation.win32">
263     <title>Installation from source on Windows</title>
264     <para>
265       Pazpar2 can be built for Windows using
266       <ulink url="&url.vstudio;">Microsoft Visual Studio</ulink>.
267       The support files for building YAZ on Windows are located in the
268       <filename>win</filename> directory. The compilation is performed
269       using the <filename>win/makefile</filename> which is to be
270       processed by the NMAKE utility part of Visual Studio.
271     </para>
272     <para>
273       Ensure that the development libraries and header files are
274       available on your system before compiling Pazpar2. For installation
275       of YAZ, refer to
276       the Installation chapter of the YAZ manual at
277       <ulink url="&url.yaz.install;"/>.
278       It is easiest if YAZ and Pazpar2 are unpacked in the same
279       directory (side-by-side).
280     </para>
281     <para>
282       The compilation is tuned by editing the makefile of Pazpar2.
283       The process is similar to YAZ. Adjust the various directories
284       <literal>YAZ_DIR</literal>, <literal>ZLIB_DIR</literal>, etc.,
285       as required.
286     </para>
287     <para>
288       Compile Pazpar2 by invoking <application>nmake</application> in
289       the <filename>win</filename> directory.
290       The resulting binaries of the build process are located in the
291       <filename>bin</filename> of the Pazpar2 source
292       tree - including the <filename>pazpar2.exe</filename> and necessary DLLs.
293     </para>
294     <para>
295       The Windows version of Pazpar2 is a console application. It may
296       be installed as a Windows Service by adding option 
297       <literal>-install</literal> for the pazpar2 program. This will
298       register Pazpar2 as a service and use the other options provided
299       in the same invocation. For example:
300       <screen>
301         cd \MyPazpar2\etc
302         ..\bin\pazpar2 -install -f pazpar2.cfg -l pazpar2.log
303       </screen>
304       The Pazpar2 service may now be controlled via the Service Control
305       Panel. It may be unregistered by passing the <literal>-remove</literal>
306       option. Example:
307       <screen>
308         cd \MyPazpar2\etc
309         ..\bin\pazpar2 -remove
310       </screen>
311     </para>
312   </section>
313
314   <section id="installation.test1">
315    <title>Installation of test interfaces</title>
316    <para>
317     In this section we show how to make available the set of simple
318     interfaces that are part of the Pazpar2 source package, and which
319     demonstrate some ways to use Pazpar2.  (Note that Debian users can 
320     save time by just installing the package <literal>pazpar2-test1</literal>.)
321    </para>
322    <para>
323     A web server, such as Apache, must be installed and running on the system.
324    </para>
325
326    <para>
327     Start the Pazpar2 daemon using the 'in-source' binary of the Pazpar2
328     daemon. On Unix the process is:
329     <screen>
330      cd etc
331      cp pazpar2.cfg.dist pazpar2.cfg
332      ../src/pazpar2 -f pazpar2.cfg
333     </screen>
334     And on Windows:
335     <screen>
336      cd etc
337      copy pazpar2.cfg.dist pazpar2.cfg
338      ..\bin\pazpar2 -f pazpar2.cfg
339     </screen>
340     This will start a Pazpar2 listener on port 9004. It will proxy 
341     HTTP requests to port 80 on localhost, which we assume will be the regular
342     HTTP server on the system. Inspect and modify pazpar2.cfg as needed
343     if this is to be changed. The pazpar2.cfg file includes settings from the
344     file <filename>settings/edu.xml</filename>
345     to use for searches.
346    </para>
347
348    <para>
349     The test UIs are located in <literal>www</literal>. Ensure that this
350     directory is available to the web server by copying 
351     <literal>www</literal> to the document root, 
352     using Apache's <literal>Alias</literal> directive, or
353     creating a symbolic link: for example, on a Debian or Ubuntu
354     system with Apache2 installed from the standard package, you might
355     make the link as follows:
356     <screen>
357      cd .../pazpar2
358      sudo ln -s `pwd`/www /var/www/pazpar2-demo
359     </screen>
360    </para>
361    
362    <para>
363     This makes the test applications visible at
364     <ulink url="http://localhost/pazpar2-demo/"/>
365     but they can not be run successfully from that URL, as they submit
366     search requests back to the server form which they were served,
367     and Apache2 doesn't know how to handle them.  Instead, the test
368     applications must be accessed from Pazpar2 itself, acting as a
369     proxy to Apache2, at the URL
370     <ulink url="http://localhost:9004/pazpar2-demo/"/>
371    </para>
372
373    <para>
374     From here, the demo applications can be
375     accessed: <literal>test1</literal>, <literal>test2</literal> and
376     <literal>jsdemo</literal>
377     are pure HTML+JavaScript setups, needing no server-side
378     intelligence; 
379     <literal>demo</literal>
380     requires PHP on the server.
381    </para>
382    <para>
383     If you don't see the test interfaces, check whether they are available
384     on port 80 (i.e. directly from the Apache2 server).  If not, the
385     Apache configuration is incorrect.
386    </para>
387    <para>
388     In order to use Apache as frontend for the interface on port 80
389     for public access etc., refer to 
390     <xref linkend="installation.apache2proxy"/>.
391    </para>
392   </section>
393
394   <section id="installation.debian">
395    <title>Installation on Debian or Ubuntu GNU/Linux</title>
396    <para>
397     Index Data provides Debian and Ubuntu packages for Pazpar2.
398     As of February 2010, these
399     are prepared for Debian versions Etch, Lenny and Squeeze; and for
400     Ubuntu versions 8.04 (hardy), 8.10 (intrepid), 9.04 (jaunty) and
401     9.10 (karmic).  These packages are available at
402     <ulink url="&url.pazpar2.download.debian;"/> and
403     <ulink url="&url.pazpar2.download.ubuntu;"/>.
404    </para>
405   </section>
406
407   <section id="installation.apache2proxy">
408    <title>Apache 2 Proxy</title>
409    <para>
410     Apache 2 has a 
411     <ulink url="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html">
412      proxy module
413     </ulink> which allows Pazpar2 to become a backend to an Apache 2
414     based web service. The Apache 2 proxy must operate in the
415     <emphasis>Reverse</emphasis> Proxy mode.
416    </para>
417    
418    <para>
419     On a Debian based Apache 2 system, the relevant modules can
420     be enabled with:
421     <screen>
422      sudo a2enmod proxy_http
423     </screen>
424    </para>
425
426    <para>
427     Traditionally Pazpar2 interprets URL paths with suffix 
428     <literal>/search.pz2</literal>.
429     The 
430     <ulink 
431      url="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass"
432      >ProxyPass</ulink> directive of Apache must be used to map a URL path
433     the the Pazpar2 server (listening port).
434    </para>
435
436    <note>
437     <para>
438      The ProxyPass directive takes a prefix rather than
439      a suffix as URL path. It is important that the Java Script code
440      uses the prefix given for it.
441     </para>
442    </note>
443
444    <example id="installation.apache2proxy.example">
445     <title>Apache 2 proxy configuration</title>
446     <para>
447      If Pazpar2 is running on port 8004 and the portal is using
448      <filename>search.pz2</filename> inside portal in directory
449      <filename>/myportal/</filename> we could use the following
450      Apache 2 configuration:
451
452      <screen><![CDATA[
453       <IfModule mod_proxy.c>
454        ProxyRequests Off
455       
456        <Proxy *>
457         AddDefaultCharset off
458         Order deny,allow
459         Allow from all
460        </Proxy>
461       
462        ProxyPass /myportal/search.pz2 http://localhost:8004/search.pz2
463        ProxyVia Off
464       </IfModule>
465       ]]></screen>
466     </para>
467    </example>
468   </section>
469
470  </chapter>
471
472  <chapter id="using">
473   <title>Using Pazpar2</title>
474   <para>
475    This chapter provides a general introduction to the use and
476    deployment of Pazpar2. 
477   </para>
478
479   <section id="architecture">
480    <title>Pazpar2 and your systems architecture</title>
481    <para>
482     Pazpar2 is designed to provide asynchronous, behind-the-scenes
483     metasearching functionality to your application, exposing this
484     functionality using a simple webservice API that can be accessed
485     from any number of development environments. In particular, it is
486     possible to combine Pazpar2 either with your server-side dynamic
487     website scripting, with scripting or code running in the browser, or
488     with any combination of the two. Pazpar2 is an excellent tool for
489     building advanced, Ajax-based user interfaces for metasearch
490     functionality, but it isn't a requirement -- you can choose to use
491     Pazpar2 entirely as a backend to your regular server-side scripting.
492     When you do use Pazpar2 in conjunction
493     with browser scripting (JavaScript/Ajax, Flash, applets,
494     etc.), there are    special considerations.
495    </para>
496
497    <para>
498     Pazpar2 implements a simple but efficient HTTP server, and it is
499     designed to interact directly with scripting running in the browser
500     for the best possible performance, and to limit overhead when
501     several browser clients generate numerous webservice requests.
502     However, it is still desirable to use a conventional webserver,
503     such as Apache, to serve up graphics, HTML documents, and
504     server-side scripting. Because the security sandbox environment of
505     most browser-side programming environments only allows communication
506     with the server from which the enclosing HTML page or object
507     originated, Pazpar2 is designed so that it can act as a transparent
508     proxy in front of an existing webserver (see <xref
509      linkend="pazpar2_conf"/> for details). 
510     In this mode, all regular
511     HTTP requests are transparently passed through to your webserver,
512     while Pazpar2 only intercepts search-related webservice requests.
513    </para>
514
515    <para>
516     If you want to expose your combined service on port 80, you can
517     either run your regular webserver on a different port, a different
518     server, or a different IP address associated with the same server.
519    </para>
520
521    <para>
522     Pazpar2 can also work behind
523     a reverse Proxy. Refer to <xref linkend="installation.apache2proxy"/>)
524     for more information.
525     This allows your existing HTTP server to operate on port 80 as usual.
526     Pazpar2 can be started on another (internal) port.
527    </para>
528
529    <para>
530     Sometimes, it may be necessary to implement functionality on your
531     regular webserver that makes use of search results, for example to
532     implement data import functionality, emailing results, history
533     lists, personal citation lists, interlibrary loan functionality,
534     etc. Fortunately, it is simple to exchange information between
535     Pazpar2, your browser scripting, and backend server-side scripting.
536     You can send a session ID and possibly a record ID from your browser
537     code to your server code, and from there use Pazpar2s webservice API
538     to access result sets or individual records. You could even 'hide'
539     all of Pazpar2s functionality between your own API implemented on
540     the server-side, and access that from the browser or elsewhere. The
541     possibilities are just about endless.
542    </para>
543   </section>
544
545   <section id="data_model">
546    <title>Your data model</title>
547    <para>
548     Pazpar2 does not have a preconceived model of what makes up a data
549     model. There are no assumptions that records have specific fields or
550     that they are organized in any particular way. The only assumption
551     is that data comes packaged in a form that the software can work
552     with (presently, that means XML or MARC), and that you can provide
553     the necessary information to massage it into Pazpar2's internal
554     record abstraction.
555    </para>
556
557    <para>
558     Handling retrieval records in Pazpar2 is a two-step process. First,
559     you decide which data elements of the source record you are
560     interested in, and you specify any desired massaging or combining of
561     elements using an XSLT stylesheet (MARC records are automatically
562     normalized to <ulink url="&url.marcxml;">MARCXML</ulink> before this step).
563     If desired, you can run multiple XSLT stylesheets in series to accomplish
564     this, but the output of the last one should be a representation of the
565     record in a schema that Pazpar2 understands.
566    </para>
567
568    <para>
569     The intermediate, internal representation of the record looks like
570     this:
571     <screen><![CDATA[
572      <record   xmlns="http://www.indexdata.com/pazpar2/1.0"
573      mergekey="title The Shining author King, Stephen">
574
575      <metadata type="title">The Shining</metadata>
576
577      <metadata type="author">King, Stephen</metadata>
578
579      <metadata type="kind">ebook</metadata>
580
581      <!-- ... and so on -->
582     </record>
583      ]]></screen>
584
585     As you can see, there isn't much to it. There are really only a few
586     important elements to this file.
587    </para>
588
589    <para>
590     Elements should belong to the namespace
591     <literal>http://www.indexdata.com/pazpar2/1.0</literal>.
592     If the root node contains the
593     attribute 'mergekey', then every record that generates the same
594     merge key (normalized for case differences, white space, and
595     truncation) will be joined into a cluster. In other words, you
596     decide how records are merged. If you don't include a merge key,
597     records are never merged. The 'metadata' elements provide the meat
598     of the elements -- the content. the 'type' attribute is used to
599     match each element against processing rules that determine what
600     happens to the data element next.
601    </para>
602
603    <para>
604     The next processing step is the extraction of metadata from the
605     intermediate representation of the record. This is governed by the
606     'metadata' elements in the 'service' section of the configuration
607     file. See <xref linkend="config-server"/> for details. The metadata
608     in the retrieval record ultimately drives merging, sorting, ranking,
609     the extraction of browse facets, and display, all configurable.
610    </para>
611   </section>
612
613   <section id="client">
614    <title>Client development overview</title>
615    <para>
616     You can use Pazpar2 from any environment that allows you to use
617     webservices. The initial goal of the software was to support
618     Ajax-based applications, but there literally are no limits to what
619     you can do. You can use Pazpar2 from Javascript, Flash, Java, etc.,
620     on the browser side, and from any development environment on the
621     server side, and you can pass session tokens and record IDs freely
622     around between these environments to build sophisticated applications.
623     Use your imagination.
624    </para>
625
626    <para>
627     The webservice API of Pazpar2 is described in detail in <xref
628      linkend="pazpar2_protocol"/>.
629    </para>
630
631    <para>
632     In brief, you use the 'init' command to create a session, a
633     temporary workspace which carries information about the current
634     search. You start a new search using the 'search' command. Once the
635     search has been started, you can follow its progress using the
636     'stat', 'bytarget', 'termlist', or 'show' commands. Detailed records
637     can be fetched using the 'record' command.
638    </para>
639   </section>
640
641   &sect-ajaxdev;
642
643   <section id="nonstandard">
644    <title>Connecting to non-standard resources</title>
645    <para>
646     Pazpar2 uses Z39.50 as its switchboard language -- i.e. as far as it
647     is concerned, all resources speak Z39.50, or its webservices derivatives,
648     SRU/SRW. It is, however, equipped
649     to handle a broad range of different server behavior, through
650     configurable query mapping and record normalization. If you develop
651     configuration, stylesheets, etc., for a new type of resources, we
652     encourage you to share your work. But you can also use Pazpar2 to
653     connect to hundreds of resources that do not support standard
654     protocols.
655    </para>
656
657    <para>
658     For a growing number of resources, Z39.50 is all you need. Over the
659     last few years, a number of commercial, full-text resources have
660     implemented Z39.50. These can be used through Pazpar2 with little or
661     no effort. Resources that use non-standard record formats will
662     require a bit of XSLT work, but that's all.
663    </para>
664
665    <para>
666     But what about resources that don't support Z39.50 at all? Some resources might
667     support OpenSearch, private, XML/HTTP-based protocols, or something
668     else entirely. Some databases exist only as web user interfaces and
669     will require screen-scraping. Still others exist only as static
670     files, or perhaps as databases supporting the OAI-PMH protocol.
671     There is hope! Read on.
672    </para>
673
674    <para>
675     Index Data continues to advocate the support of open standards. We
676     work with database vendors to support standards, so you don't have
677     to worry about programming against non-standard services. We also
678     provide tools (see <ulink
679      url="http://www.indexdata.com/simpleserver">SimpleServer</ulink>)
680     which make it comparatively easy to build gateways against servers
681     with non-standard behavior. Again, we encourage you to share any
682     work you do in this direction.
683    </para>
684
685    <para>
686     But the bottom line is that working with non-standard resources in
687     metasearching is really, really hard. If you want to build a
688     project with Pazpar2, and you need access to resources with
689     non-standard interfaces, we can help. We run gateways to more than
690     2,000 popular, commercial databases and other resources,
691     making it simple 
692     to plug them directly into Pazpar2. For a small annual fee per
693     database, we can help you establish connections to your licensed
694     resources. Meanwhile, you can help! If you build your own
695     standards-compliant gateways, host them for others, or share the
696     code! And tell your vendors that they can save everybody money and
697     increase the appeal of their resources by supporting standards.
698    </para>
699
700    <para>
701     There are those who will ask us why we are using Z39.50 as our
702     switchboard language rather than a different protocol. Basically,
703     we believe that Z39.50 is presently the most widely implemented 
704     information retrieval protocol that has the level of functionality
705     required to support a good metasearching experience (structured
706     searching, structured, well-defined results). It is also compact and
707     efficient, and there is a very broad range of tools available to
708     implement it.
709    </para>
710   </section>
711
712   <section id="unicode">
713    <title>Unicode Compliance</title>
714    <para>
715     Pazpar2 is Unicode compliant and language and locale aware but relies
716     on character encoding for the targets to be specified correctly if
717     the targets themselves are not UTF-8 based (most aren't).
718     Just a few bad behaving targets can spoil the search experience
719     considerably if for example Greek, Russian or otherwise non 7-bit ASCII
720     search terms are entered. In these cases some targets return
721     records irrelevant to the query, and the result screens will be
722     cluttered with noise.
723    </para>
724    <para>
725     While noise from misbehaving targets can not be removed, it can
726     be reduced using truly Unicode based ranking. This is an
727     option which is available to the system administrator if ICU
728     support is compiled into Pazpar2, see
729     <xref linkend="installation"/> for details.
730    </para>
731    <para>
732     In addition, the ICU tokenization and normalization rules must
733     be defined in the master configuration file described in 
734     <xref linkend="config-server"/>.
735    </para>
736   </section>
737
738   <section id="load_balancing">
739    <title>Load balancing</title>
740    <para>
741      Just like any web server, Pazpar2, can be load balanced by a standard hardware or software load balancer as long as the session stickiness is ensured. If you are already running the Apache2 web server in front of Pazpar2 and use the apache mod_proxy module to 'relay' client requests to Pazpar2, this set up can be easily extended to include load balancing capabilites. To do so you need to enable the <ulink url="http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html">
742      mod_proxy_balancer
743     </ulink> module in your Apache2 installation.
744    </para>
745    
746    <para>
747     On a Debian based Apache 2 system, the relevant modules can
748     be enabled with:
749     <screen>
750      sudo a2enmod proxy_http
751     </screen>
752    </para>
753
754    <para>
755      The mod_proxy_balancer can pass all 'sessionsticky' requests to the same backend worker as long as the requests are marked with the originating worker's ID (called 'route'). If the Pazpar2 serverID is configured (by setting an 'id' attribute on the 'server' element in the Pazpar2 configuration file) Pazpar2 will append it to the 'session' element returned during the 'init' in a mod_proxy_balancer compatible manner. Since the 'session' is then re-sent by the client (for all pazpar2 request besides 'init'), the balancer can use the marker to pass the request to the right route. To do so the balancer needs to be configured to inspect the 'session' parameter.
756    </para>
757
758    <example id="load_balancing.example">
759     <title>Apache 2 load balancing configuration</title>
760     <para>
761      Having 4 Pazpar2 instances running on the same host, port range of 8004-8007 and serverIDs of: pz1, pz2, pz3 and pz4 respectively we could use the following Apache 2 configuration to expose a single pazpar2 'endpoint' on a standard (<filename>/pazpar2/search.pz2</filename>) location:
762
763      <screen><![CDATA[
764        <Proxy *>
765          AddDefaultCharset off
766          Order deny,allow
767          Allow from all
768        </Proxy>
769        ProxyVia Off
770
771        # 'route' has to match the configured pazpar2 server ID
772        <Proxy balancer://pz2cluster>
773          BalancerMember http://localhost:8004 route=pz1
774          BalancerMember http://localhost:8005 route=pz2
775          BalancerMember http://localhost:8006 route=pz3
776          BalancerMember http://localhost:8007 route=pz4
777        </Proxy>
778
779        # route is resent in the 'session' param which has the form: 
780        # 'sessid.serverid', understandable by the mod_proxy_load_balancer
781        # this is not going to work if the client tampers with the 'session' param
782        ProxyPass /pazpar2/search.pz2 balancer://pz2cluster lbmethod=byrequests stickysession=session nofailover=On]]></screen>
783
784      The 'ProxyPass' line sets up a reverse proxy for request ‘/pazpar2/search.pz2’ and delegates all requests to the load balancer (virtual worker) with name ‘pz2cluster’. Sticky sessions are enabled and implemented using the ‘session’ parameter. The ‘Proxy’ section lists all the servers (real workers) which the load balancer can use.
785    </para>
786
787   </example>
788
789   </section>
790
791
792  </chapter> <!-- Using Pazpar2 -->
793
794  <reference id="reference">
795   <title>Reference</title>
796   <partintro id="reference-introduction">
797    <para>
798     The material in this chapter is drawn directly from the individual
799     manual entries.
800    </para>
801   </partintro>
802   &manref;
803  </reference>
804
805  <appendix id="license"><title>License</title>
806   
807    <para>
808     Pazpar2,
809     Copyright &copy; &copyright-year; Index Data.
810    </para>
811    
812    <para>
813     Pazpar2 is free software; you can redistribute it and/or modify it under
814     the terms of the GNU General Public License as published by the Free
815     Software Foundation; either version 2, or (at your option) any later
816     version.
817    </para>
818    
819    <para>
820     Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
821     WARRANTY; without even the implied warranty of MERCHANTABILITY or
822     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
823     for more details.
824    </para>
825    
826    <para>
827     You should have received a copy of the GNU General Public License
828     along with Pazpar2; see the file LICENSE.  If not, write to the
829     Free Software Foundation, 
830     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
831    </para>
832
833  </appendix>
834
835  &gpl2;
836  
837 </book>
838
839  <!-- Keep this comment at the end of the file
840  Local variables:
841  mode: sgml
842  sgml-omittag:t
843  sgml-shorttag:t
844  sgml-minimize-attributes:nil
845  sgml-always-quote-attributes:t
846  sgml-indent-step:1
847  sgml-indent-data:t
848  sgml-parent-document: nil
849  sgml-local-catalogs: nil
850  sgml-namecase-general:t
851  End:
852  -->