Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 097dd4e9e72d844830e823e5746f6c3b > files > 45

swish-e-2.4.7-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!-- 
    ***** GENERATED FILE *** DO NOT EDIT DIRECTLY - any changes will be LOST ******

    swish-e.org mockup based on http://www.oswd.org/design/1773/prosimii/index2.html 
-->


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" type="text/css" href="./swish.css" media="screen" title="swish css" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

    
        <link rel="Last" href="./filter.html" />
    
        <link rel="Prev" href="./readme.html" />
    
        <link rel="Up" href="./index.html" />
    
        <link rel="Next" href="./changes.html" />
    
        <link rel="Start" href="./index.html" />
    
        <link rel="First" href="./readme.html" />
    

    <title>Swish-e :: INSTALL - Swish-e Installation Instructions</title>


  </head>


<body>
    

    <!-- noindex -->

    <!-- For non-visual user agents: -->
      <div id="top"><a href="#main-copy" class="doNotDisplay doNotPrint">Skip to main content.</a></div>

    <!-- ##### Header ##### -->

    <div id="header">
      <div class="superHeader">
        <span>Related Sites:</span>
            <a href="http://swishewiki.org/" title="swishe wiki">swish-e wiki</a> |
            <a href="http://www.xmlsoft.org/" title="libxml2 home page">libxml2</a> |
            <a href="http://www.zlib.net/" title="zlib home page">zlib</a> |
            <a href="http://www.foolabs.com/xpdf/" title="xpdf home page">xpdf</a> |
            <a href="http://dev.swish-e.org/browser" title="browse source code">Subversion</a>
      </div>

      <div class="midHeader">
        <h1 class="headerTitle" lang="la">Swish-e</h1>
        <div class="headerSubTitle">Simple Web Indexing System for Humans - Enhanced</div>

        <br class="doNotDisplay doNotPrint" />

        <div class="headerLinks">
          <span class="doNotDisplay">Tools:</span>

              <!-- don't know what platform, so link to download page -->

              <a href="http://swish-e.org/download/index.html">download latest version</a>

        </div>
      </div>
    </div>
    <!-- index -->

<!-- noindex -->
<div class="subHeader">
    <table width='100%'>
        <tr>
            <td align='left'>
                <a href="http://swish-e.org/index.html">home</a> |
                <a href="http://swish-e.org/support.html">support</a> |
                <a href="http://swish-e.org/download/index.html">download</a>
            </td>


            
            <td align='right'>

                <form method="get"
                    action="http://swish-e.org/search/index.html"
                    enctype="application/x-www-form-urlencoded"
                    class="srchform">

                    <label for="searchfield">Search for</label>
                    <input maxlength="200" value="" id="searchfield" size="30" name="query" type="text" alt="Search input field" />
                    <input value="search swish-e.org" name="submit" type="submit" class='button' />
                </form>

            </td>
            
        </tr>
    </table>
</div>
<!-- index -->


<div id="body-area" class="clearfix">

    <div id="content-area">

        <div id="main-copy">
            
            
            
            
<h1>INSTALL - Swish-e Installation Instructions</h1>
Swish-e version 2.4.7



    <!-- noindex -->

    
        <h2>Table of Contents</h2>
        <div class="toc">
            
    <ul class="toc">
        
            <li>
                <a href="#overview">OVERVIEW</a>
                
    <ul class="toc">
        
            <li>
                <a href="#upgrading_from_previous_versions_of_swish_e">Upgrading from previous versions of Swish-e</a>
                
            </li>
        
            <li>
                <a href="#windows_users">Windows Users</a>
                
            </li>
        
            <li>
                <a href="#building_from_cvs">Building from CVS</a>
                
            </li>
        
    </ul>

            </li>
        
            <li>
                <a href="#system_requirements">SYSTEM REQUIREMENTS</a>
                
    <ul class="toc">
        
            <li>
                <a href="#software_requirements">Software Requirements</a>
                
            </li>
        
            <li>
                <a href="#optional_but_recommended_packages">Optional but Recommended Packages</a>
                
            </li>
        
    </ul>

            </li>
        
            <li>
                <a href="#installation">INSTALLATION</a>
                
    <ul class="toc">
        
            <li>
                <a href="#building_swish_e">Building Swish-e</a>
                
            </li>
        
            <li>
                <a href="#installing_without_root_access">Installing without root access</a>
                
            </li>
        
            <li>
                <a href="#run_time_paths">Run-time paths</a>
                
            </li>
        
            <li>
                <a href="#building_a_debian_package">Building a Debian Package</a>
                
            </li>
        
            <li>
                <a href="#what_s_installed">What's installed</a>
                
            </li>
        
            <li>
                <a href="#documentation">Documentation</a>
                
            </li>
        
            <li>
                <a href="#the_swish_e_documentation_as_man_1_pages">The Swish-e documentation as man(1) pages</a>
                
            </li>
        
            <li>
                <a href="#join_the_swish_e_discussion_list">Join the Swish-e discussion list</a>
                
            </li>
        
    </ul>

            </li>
        
            <li>
                <a href="#questions_and_troubleshooting">QUESTIONS AND TROUBLESHOOTING</a>
                
    <ul class="toc">
        
            <li>
                <a href="#when_posting_please_provide_the_following_information_">When posting, please provide the following information:</a>
                
            </li>
        
    </ul>

            </li>
        
            <li>
                <a href="#additional_installation_options">ADDITIONAL INSTALLATION OPTIONS</a>
                
    <ul class="toc">
        
            <li>
                <a href="#the_swish_api_perl_module">The SWISH::API Perl Module</a>
                
            </li>
        
    </ul>

            </li>
        
            <li>
                <a href="#general_configuration_and_usage">GENERAL CONFIGURATION AND USAGE</a>
                
    <ul class="toc">
        
            <li>
                <a href="#introduction_to_indexing_and_searching">Introduction to Indexing and Searching</a>
                
            </li>
        
            <li>
                <a href="#metanames_and_properties">Metanames and Properties</a>
                
            </li>
        
            <li>
                <a href="#getting_started_with_swish_e">Getting Started With Swish-e</a>
                
            </li>
        
            <li>
                <a href="#step_1_create_a_configuration_file">Step 1: Create a Configuration File</a>
                
            </li>
        
            <li>
                <a href="#step_2_index_your_files">Step 2: Index your Files</a>
                
            </li>
        
            <li>
                <a href="#step_3_search">Step 3: Search</a>
                
            </li>
        
            <li>
                <a href="#phrase_searching">Phrase Searching</a>
                
            </li>
        
            <li>
                <a href="#boolean_searching">Boolean Searching</a>
                
            </li>
        
            <li>
                <a href="#context_searching">Context Searching</a>
                
            </li>
        
            <li>
                <a href="#meta_tags">META Tags</a>
                
            </li>
        
            <li>
                <a href="#spidering_and_searching_with_a_web_form_">Spidering and Searching with a Web form.</a>
                
            </li>
        
    </ul>

            </li>
        
            <li>
                <a href="#indexing_other_types_of_documents_filtering">Indexing Other Types of Documents - Filtering</a>
                
    <ul class="toc">
        
            <li>
                <a href="#filtering_overview">Filtering Overview</a>
                
            </li>
        
            <li>
                <a href="#filtering_examples">Filtering Examples</a>
                
            </li>
        
    </ul>

            </li>
        
            <li>
                <a href="#document_info">Document Info</a>
                
            </li>
        
    </ul>

        </div>
    
    <!-- index -->





<hr />


    <div class="sub-section">
        
<h1><a name="overview"></a>OVERVIEW</h1>

<p>This document describes how to download, build,
and install Swish-e from source.
Also found below is a basic overview of using Swish-e to index documents,
with pointers to other, more advanced examples.</p>
<p>This document also provides instructions
on how to get help installing and using Swish-e
(and the important information you should provide when asking for help).
Please read these instructions <b>before requesting help</b>
on the Swish-e discussion list.
See <a href="#questions_and_troubleshooting">"QUESTIONS AND TROUBLESHOOTING"</a>.</p>
<p>Although building from source is recommended,
some OS distributions (e.g., Debian) provide pre-compiled binaries.
Check with your distribution for available packages.
Build from source,
if your distribution does not offer the current version of Swish-e.</p>
<p>Also, please read the Swish-e FAQ (<a href="swish-faq.html">SWISH-FAQ</a>),
as it answers many frequently-asked questions.</p>
<p>Swish-e knows how to index HTML, XML, and plain text documents.
Helper applications and other tools are used to convert documents
such as PDF or MS Word into a format that Swish-e can index.
These additional applications and tools (listed below)
must be installed separately.
The process of converting documents is called "filtering".</p>
<p>NOTE: Swish-e version 4.2.0 installs a lot more files
when running "make install".
Be aware that the Swish-e documentation may thus include errors
about where files are located.
Please notify the Swish-e discussion list of any documentation errors.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="upgrading_from_previous_versions_of_swish_e"></a>Upgrading from previous versions of Swish-e</h2>

<p>If you are upgrading from a previous version of Swish-e,
read the <a href="changes.html">CHANGES</a> page first.
The Swish-e index format may have changed
and existing indexes may not work with the newer version of Swish-e.</p>
<p>If you have existing indexes,
you may need to re-index your data
before running the "make install" step described below.
Swish-e may be run from the build directory after compiling,
but before installation.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="windows_users"></a>Windows Users</h2>

<p>A Windows binary version is available
as a separate download from the Swish-e site (<a href="http://swish-e.org">http://swish-e.org</a>).
Many of the installation instructions below will not apply to Windows users;
the Windows version is pre-compiled
and includes <i>libxml2</i>, <i>zlib</i>, <i>xpdf</i>, and <i>catdoc</i>.</p>
<p>A number of Perl modules may also be needed.
These can be installed with ActiveState's PPM utility.</p>
<pre class="pre-section">   libwww-perl   - the LWP modules (for spidering)
   HTML-Tagset   - used by web spider
   HTML-Parser   - used by web spider
   MIME-Types    - used for filtering documents when not spidering
   HTML-Template - formatting output from swish.cgi (optional)
   HTML-FillInForm (if HTML-Template is used)</pre>

    </div>

    <div class="sub-section">
        
<h2><a name="building_from_cvs"></a>Building from CVS</h2>

<p>Please refer to the <i>README.cvs</i> file found in the documentation directory
<i>$prefix/share/doc/swish-e</i>.</p>

    </div>

    <div class="sub-section">
        
<h1><a name="system_requirements"></a>SYSTEM REQUIREMENTS</h1>

<p>Swish-e makes use of a number of libraries and tools
that are not distributed with Swish-e.
Some libraries need to be installed before building Swish-e from source;
other tools can be installed at any time.
See below for details.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="software_requirements"></a>Software Requirements</h2>

<p>Swish-e is written in C.
It has been tested on a number of platforms,
including Sun/Solaris, Dec Alpha, BSD, Linux, Mac OS X, and Open VMS.</p>
<p>The GNU C compiler (gcc) and GNU make are strongly recommended.
Repeat: you will find life easier if you use the GNU tools.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="optional_but_recommended_packages"></a>Optional but Recommended Packages</h2>

<p>Most of the packages listed below are available
as easily installable packages.
Check with your operating system vendor or install them from source.
Most are very common packages that may already be installed on your computer.</p>
<p>As noted below,
some packages need to be installed before building Swish-e from source,
while others may be added after Swish-e is installed.</p>
<ul>
<li><a name="item_libxml2"></a><a name="libxml2"></a><b>Libxml2</b>
<p><i>libxml2</i> is very strongly recommended.
It is used for parsing both HTML and XML files.
Swish-e can be built and installed without <i>libxml2</i>,
but the HTML parser that is built into Swish-e
is not as accurate as <i>libxml2</i>.</p>
<pre class="pre-section">    http://xmlsoft.org/</pre>
<p><i>libxml2</i> must be installed before Swish-e is built,
or it will not be used.</p>
<p>If <i>libxml2</i> is installed in a non-standard location
(e.g., <i>libxml2</i> is built with <code>--prefix $HOME/local</code>),
make sure that you add the <code>bin</code> directory to your <code>$PATH</code>
before building Swish-e.
Swish-e's configure script uses a program
created by <i>libxml2</i> (<code>xml2-config</code>)
to find the location of <i>libxml2</i>.
Use <code>which xml2-config</code> to verify
that the program can be found where expected.</p>
</li>
<li><a name="item_zlib"></a><a name="zlib"></a><b>Zlib Compression</b>
<p>The <i>Zlib</i> compression library is commonly installed on most systems
and is recommended for use with Swish-e.
<i>Zlib</i> is used for compressing text stored in the Swish-e index.</p>
<pre class="pre-section">    http://www.gzip.org/zlib/</pre>
<p><i>Zlib</i> must be installed before building Swish-e.</p>
</li>
<li><a name="item_perl"></a><a name="perl"></a><b>Perl Modules</b>
<p>Although Swish-e is a compiled C program,
many support features use Perl.
For example, both the web spiders
and modules to help with filtering documents are written in Perl.</p>
<p>The following Perl modules may be required.
Check your current Perl installation,
as many may already be installed.</p>
<pre class="pre-section">    LWP
    URI
    HTML::Parser
    HTML::Tagset
    MIME::Types (optional)</pre>
<p>Note that installing <code>Bundle::LWP</code> with the CPAN module</p>
<pre class="pre-section">    perl -MCPAN -e 'install Bundle::LWP'</pre>
<p>will install many of the above modules.</p>
<p>If you wish to use <code>HTML-Template</code> with swish.cgi to generate output,
install:</p>
<pre class="pre-section">    HTML::Template
    HTML::FillInForm</pre>
<p>If you wish to use <code>Template-Toolkit</code> with <code>swish.cgi</code>
to generate output, install:</p>
<pre class="pre-section">    Template</pre>
<p>Questions about installing these modules
may be sent to the Swish-e discussion list.</p>
<p>The <code>search.cgi</code> example script
requires both <code>Template-Toolkit</code> and <code>HTML::FillInForm</code>.</p>
</li>
<li><a name="item_indexing"></a><a name="indexing"></a><b>Indexing PDF Documents</b>
<p>Indexing PDF files requires the <code>xpdf</code> package.
This is a common package,
available with most operating systems
and often provided as an add-on package.</p>
<pre class="pre-section">    http://www.foolabs.com/xpdf/</pre>
<p>Xpdf may be added after Swish-e is installed.</p>
</li>
<li><a name="item_indexing"></a><a name="indexing"></a><b>Indexing MS Word Documents</b>
<p>Indexing MS Word documents requires the <i>Catdoc</i> program.</p>
<pre class="pre-section">    http://www.wagner.pp.ru/~vitus/software/catdoc/</pre>
<p><i>Catdoc</i> may be added after Swish-e is installed.</p>
</li>
<li><a name="item_indexing"></a><a name="indexing"></a><b>Indexing MP3 ID3 Tags</b>
<p>Indexing MP3 ID3 Tags requires the <code>MP3::Tag</code> Perl module.
See <a href="http://search.cpan.org">http://search.cpan.org</a>.
<code>MP3::Tag</code> may be installed after Swish-e is installed.</p>
</li>
<li><a name="item_indexing"></a><a name="indexing"></a><b>Indexing MS Excel Files</b>
<p>Indexing MS Excel files is supported by the following Perl modules,
also available at <a href="http://search.cpan.org">http://search.cpan.org</a>.</p>
<pre class="pre-section">    Spreadsheet::ParseExcel
    HTML::Entities</pre>
<p>These Perl modules may be installed after Swish-e is installed.</p>
</li>
</ul>

    </div>

    <div class="sub-section">
        
<h1><a name="installation"></a>INSTALLATION</h1>

<p>Here are brief installation instructions that should work in most cases.
Following this section are more detailed instructions and examples.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="building_swish_e"></a>Building Swish-e</h2>

<p>Download Swish-e using your favorite web browser
or a utility such as <code>wget</code>, <code>lynx</code>, or <code>lwp-download</code>.
Unpack and build the distribution, using the following steps:</p>
<p>Note: "swish-e-2.4.0" is used as an example.
Download the most current available version
and adjust the commands below!
Also, if you are running Debian,
see the notes below on building a <code>.deb</code> package
from the Swish-e source package.</p>
<p>Pay careful attention to the "prompt" character used
on the following command lines.
A "$" prompt indicates steps run as an unprivileged user.
A "#" indicates steps run as the superuser (root).</p>
<pre class="pre-section">    $ wget http://swish-e.org/Download/swish-e-2.4.0.tar.gz
    $ gzip -dc swihs-e-2.4.0.tar.gz | tar xof -
    $ cd swish-e-2.4.0  (this directory will depend on the version of Swish-e)

    $ ./configure
    $ make
    $ make check
    ...
    ==================
    All 3 tests passed
    ==================

    $ su root  (or use sudo)
    (enter password)

    # make install
    # exit
    $ swish-e -V
    SWISH-E 2.4.0</pre>
<p><b>IMPORTANT:</b>
Once Swish-e is installed, do not run it as the superuser (root) --
root is only required during the installation step,
when installing into system directories.
Please do not break this rule.</p>
<p><b>NOTE:</b>
If you are upgrading from an older version of Swish-e,
be sure and review the <a href="changes.html">CHANGES</a> file.
Old index files may not be compatible with newer versions of Swish-e.
After building Swish-e (but before running "make install"),
Swish-e can be run from the build directory:</p>
<pre class="pre-section">    $ src/swish-e -V</pre>
<p>To minimize downtime,
create new index files before running "make install",
by using Swish-e from the build directory.
Then, copy the index files to the live location and run "make install":</p>
<pre class="pre-section">    $ src/swish-e -c /path/to/config -f index.new</pre>
<p>Keep in mind that the location you index from
may affect the paths stored in the index file.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="installing_without_root_access"></a>Installing without root access</h2>

<p>Here's another installation example.
This might be used if you do not have root access
or you wish to install Swish-e someplace other than <code>/usr/local</code>.</p>
<p>This example also shows building Swish-e in a "build" directory
that is  separate from where the source files are located.
This is the recommended way to build Swish-e,
but it requires GNU Make.
Without GNU Make,
you will likely need to build from within the source directory,
as shown in the previous example.</p>
<pre class="pre-section">    $ tar zxof swish-e-2.4.0.tar.gz  (GNU tar with "z" option)
    $ mkdir build
    $ cd build</pre>
<p>Note that the current directory is not where Swish-e was unpacked.</p>
<p>Swish-e uses a <i>configure</i> script.
<i>configure</i> has many options,
but it uses reasonable and standard defaults.
Running</p>
<pre class="pre-section">    $ ../swish-e-2.4.0/configure --help</pre>
<p>will display the options.</p>
<p>Two options are of common interest:
<code>--prefix</code> sets the top-level installation directory;
<code>--disable-shared</code> will link Swish-e statically,
which may be needed on some platforms (Solaris 2.6, perhaps).</p>
<p>Platforms may require varying link instructions
when libraries are installed in non-standard locations.
Swish-e uses the GNU <i>autoconf</i> tools for building the package.
<i>autoconf</i> is good at building and testing,
but still requires you to provide information appropriate for your platform.
This may mean reading the manual page for your compiler and linker
to see how to specify non-standard file locations.</p>
<p>For most Unix-type platforms,
you can use <code>LDFLAGS</code> and <code>CPPFLAGS</code> environment variables
to specify paths to "include" (header) files
and to libraries that are not in standard locations.</p>
<p>In this example, we do not have root access.
We have installed <i>libxml2</i> and <i>libz</i> in <code>$HOME/local</code>.
Swish-e will also be installed in <code>$HOME/local</code>
(by using the <code>--prefix</code> setting).</p>
<p>In this case,
you would need to add <code>$HOME/local/bin</code>
to the start of your shell's <code>$PATH</code> setting.
This is required because <i>libxml2</i> installs a program
that is used when running the configure script.
Before running configure, type:</p>
<pre class="pre-section">    $ which xml2-config</pre>
<p>It should list <code>$HOME/local/bin/xml2-config</code>.</p>
<p>Now run <i>configure</i> (remember, we are in a separate "build" directory):</p>
<pre class="pre-section">    $ ../swish-e-2.4.0/configure \
        --prefix=$HOME/local \
        CPPFLAGS=-I$HOME/local/include \
        LDFLAGS="-R$HOME/local/lib -L$HOME/local/lib"

    $ make &gt;/dev/null  (redirect output to only see warnings and errors)

    $ make check
    ...
    ==================
    All 3 tests passed
    ==================

    $ make install
    $ $HOME/local/bin/swish-e -V 
    SWISH-E 2.4.0</pre>
<p>Note the use of double quotes in the <code>LDFLAGS</code> line above.
This allows <code>$HOME</code> to be expanded within the text string.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="run_time_paths"></a>Run-time paths</h2>

<p>The <code>-R</code> option says to add a specified path (or paths)
to those that are used to find shared libraries at run time.
These paths are stored in the Swish-e binary.
When Swish-e is run,
it will look in these directories for shared libraries.</p>
<p>Some platforms may not support the <code>-R</code> option.
In this event,
set the <code>LD_RUN_PATH</code> environment variable <b>before</b> running make.</p>
<p>Some systems, such as Redhat,
do not look in <code>/usr/local/lib</code> for libraries.
In these cases,
you can either use <code>-R</code>, as above, when building Swish-e
or add <code>/usr/local/lib</code> to <code>/etc/ld.so.conf</code> and run <i>ldconfig</i> as root.</p>
<p>If all else fails,
you may need to actually read the man pages for your platform.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="building_a_debian_package"></a>Building a Debian Package</h2>

<p>The Swish-e distribution includes the files required
to build a Debian package.</p>
<pre class="pre-section">    $ tar zxof swish-e-2.4.0.tar.gz  (GNU tar with "z" option)
    $ cd swish-e-2.4.0
    $ fakeroot debian/rules binary
    [lots of output]
    dpkg-deb: building package `swish-e' in `../swish-e_2.4.0-0_i386.deb'.
    $ su
    # dpkg -i ../swish-e_2.4.0-0_i386.deb</pre>

    </div>

    <div class="sub-section">
        
<h2><a name="what_s_installed"></a>What's installed</h2>

<p>Swish installs a number of files.
By default, all files are installed below <code>/usr/local</code>,
but this can be changed by setting <code>--prefix</code>
when running <i>configure</i> (as shown above).
Individual paths may also be set.
Run <code>configure --help</code> for details.</p>
<pre class="pre-section">   $prefix/bin/swish-e         The Swish-e binary program
   $prefix/share/doc/swish-e/  Full documentation and examples
   $prefix/lib/libswish-e      The Swish-e C library
   $prefix/include/swish-e.h   The library header file
   $prefix/man/man1/           Documentation as manual pages
   $prefix/lib/swish-e/        Helper programs (spider.pl, swishspider, swish.cgi)
   $prefix/lib/swish-e/perl/   Perl helper modules</pre>
<p>Note that the Perl modules are <i>not</i> installed in the system Perl library.
Swish-e and the Perl scripts that require the modules
know where to find the modules,
but the <i>perldoc</i> program (used for reading documentation) does not. 
This can be corrected by adding <code>$prefix/lib/swish-e</code>
and <code>$prefix/lib/swish-e/perl</code> to the <code>PERL5LIB</code> environment variable.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="documentation"></a>Documentation</h2>

<p>Documentation can be found in the <code>$prefix/share/doc/swish-e</code> directory.
Documentation is in html format at <code>$prefix/share/doc/swish-e/html</code> and
can also be read on-line at the Swish-e web site:</p>
<pre class="pre-section">    http://swish-e.org/</pre>

    </div>

    <div class="sub-section">
        
<h2><a name="the_swish_e_documentation_as_man_1_pages"></a>The Swish-e documentation as man(1) pages</h2>

<p>Running "make install" installs some of the Swish-e documentation as man pages.
The following man pages are installed:</p>
<pre class="pre-section">    SWISH-FAQ(1)
    SWISH-CONFIG(1)
    SWISH-RUN(1)
    SWISH-LIBRARY(1)</pre>
<p>The man pages are installed, by default, in the system man directory.
This directory is determined when <i>configure</i> is run;
it can be set by passing a directory name to <i>configure</i>.</p>
<p>For example,</p>
<pre class="pre-section">    ./configure --mandir=/usr/local/doc/man</pre>
<p>The man directory is specified relative to the <code>--prefix</code> setting.
If you use <code>--prefix</code>,
you do not normally need to also specify <code>--mandir</code>.</p>
<p>Information on running <i>configure</i> can be found by typing:</p>
<pre class="pre-section">    ./configure --help</pre>

    </div>

    <div class="sub-section">
        
<h2><a name="join_the_swish_e_discussion_list"></a>Join the Swish-e discussion list</h2>

<p>The final step, when installing Swish-e,
is to join the Swish-e discussion list.</p>
<p>The Swish-e discussion list is the place
to ask questions about installing and using Swish-e,
see or post bug fixes or security announcements,
and offer help to others.
Please do not contact the developers directly.</p>
<p>The list is typically <i>very low traffic</i>,
so it won't overload your inbox.
Please take the time to subscribe.
See <a href="http://Swish-e.org">http://Swish-e.org</a>.</p>
<p>If you are using Swish-e on a public site,
please let the list know,
so that your URL can be added to the list of sites that use Swish-e!</p>
<p>Please review the next section
before posting questions to the Swish-e list.</p>

    </div>

    <div class="sub-section">
        
<h1><a name="questions_and_troubleshooting"></a>QUESTIONS AND TROUBLESHOOTING</h1>

<p>Support for installation, configuration, and usage
is available via the Swish-e discussion list.
Visit <a href="http://swish-e.org">http://swish-e.org</a> for information.
Do not contact developers directly for help --
always post your question to the list.</p>
<p>It's very important to provide the right information
when asking for help.</p>
<p>Please search the Swish-e list archive before posting a question.
Also, check the <a href="swish-faq.html">SWISH-FAQ</a>
to see if your question has already been asked and answered.</p>
<p>Before posting, use the available tools to narrow down the problem.</p>
<p>Swish-e has several switches
(e.g., <code>-T</code>, <code>-v</code>, and <code>-k</code>)
that may help you resolve issues.
These switches are described on the <a href="swish-run.html">SWISH-RUN</a> page.
For example, if you cannot find a document by a keyword
that you believe should be indexed,
try indexing just that single file
and use the <code>-T INDEXED_WORDS</code> option
to see if the word is actually being indexed.
First, try it without any changes to default settings:</p>
<pre class="pre-section">    swish-e -i testdoc.html -T indexed_words | less</pre>
<p>if that works, add in your configuration file:</p>
<pre class="pre-section">    swish-e -i testdoc.html -c swish.conf -T indexed_words | less</pre>
<p>If it still isn't working as you expect,
try to reduce the test document to a very small example.
This will be very helpful to your readers,
when you are asking for help.</p>
<p>Another useful trick is to use <code>-H9</code> when searching,
to display full headers in search results.
Look at the "Parsed Words" header
to see what words Swish-e is searching for.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="when_posting_please_provide_the_following_information_"></a>When posting, please provide the following information:</h2>

<p>Use these guidelines when asking for help.
The most important tip is to provide the <b>least</b> amount of information
that can be used to reproduce your problem.
Do not paraphrase output -- copy-and-paste --
but trim text that is not necessary. </p>
<ul>
<li>
<p>The exact version of Swish-e that you are using.
Running Swish-e with the <code>-V</code> switch will print the version number.
Also, supply the output from <code>uname -a</code> or similar command
that identifies the operating system you are running on.
If you are running an old version of swish,
be prepared for a response of "upgrade" to your question.</p>
</li>
<li>
<p>A summary of the problem.
This should include the commands issued
(e.g. for indexing or searching) and their output,
along with an explanation of why you don't think it's working correctly.
Please copy-and-paste the exact commands and their output,
instead of retyping, to avoid errors.</p>
</li>
<li>
<p>Include a copy of the configuration file you are using, if any.
Swish-e has reasonable defaults,
so in many cases you can run it without using a configuration file.
But, if you need to use a configuration file,
<b>reduce it down</b> to the absolute minimum number of commands
that is required to demonstrate your problem.
Again, copy-and-paste.</p>
</li>
<li>
<p>A small copy of a source document that demonstrates the problem.</p>
<p>If you are having problems spidering a web server,
use lwp-download or wget to copy the file locally,
then make sure you can index the document using the file system method.
This will help you determine if the problem
is with spidering or indexing.</p>
<p>If you expect help with spidering,
don't post fake URLs, as it makes it impossible to test.
If you don't want to expose your web page to the people on the Swish-e list,
find some other site to test spidering on.
If that works, but you still cannot spider your own site,
you may need to request help from others.
If so, you must post your real URL
or make a test document available via some other source.</p>
</li>
<li>
<p>If you are having trouble building Swish-e,
please copy-and-paste the output from make
(or from <code>./configure</code>, if that's where the problem is).</p>
</li>
</ul>
<p>The key is to provide enough information
so that others may reproduce the problem. </p>

    </div>

    <div class="sub-section">
        
<h1><a name="additional_installation_options"></a>ADDITIONAL INSTALLATION OPTIONS</h1>

<p>These steps are not required for normal use of Swish-e.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="the_swish_api_perl_module"></a>The SWISH::API Perl Module</h2>

<p>The Swish-e distribution includes a module
that provides a Perl interface to the Swish-e C library.
This module provides a way to search a Swish-e index
without running the Swish-e program.
Searching an index will be many times faster
when running under a persistent environment
such as Apache/mod_perl with the <code>SWISH::API</code> module.</p>
<p>See the <i>perl/README</i> file for information
on installing and using the <code>SWISH::API</code> Perl module.</p>

    </div>

    <div class="sub-section">
        
<h1><a name="general_configuration_and_usage"></a>GENERAL CONFIGURATION AND USAGE</h1>

<p>This section should give you a basic overview
of indexing and searching with <b>Swish-e</b>.
Other examples can be found in the <code>conf</code> directory;
these will step you through a number of different configurations.
Also, please review the <a href="swish-faq.html">SWISH-FAQ</a>.</p>
<p>Swish-e is a command-line program.
The program is controlled by passing switches on the command line.
A configuration file may be used,
but often is not required.
Swish-e does not include a graphical user interface.
Example CGI scripts are provided in the distribution,
but they require additional setup to use.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="introduction_to_indexing_and_searching"></a>Introduction to Indexing and Searching</h2>

<p>Swish-e can index files that are located on the local file system.
For example, running:</p>
<pre class="pre-section">     swish-e -i /var/www/htdocs</pre>
<p>will index <i>all</i> files in the <code>/var/www/htdocs</code> directory.
You may specify one or more files or directories with the <code>-i</code> option.
By default, this will create an index called <code>index.swish-e</code>
in the current directory.</p>
<p>To search the resulting index for a given word, try:</p>
<pre class="pre-section">     swish-e -w apache</pre>
<p>This will find the word "apache" in the body or title
of the indexed documents.</p>
<p>As mentioned above,
Swish-e will index all files in a directory,
unless instructed otherwise.
So, if <code>/var/www/htdocs</code> contains non-HTML files,
you will need a configuration file to limit the files that Swish-e indexes.
Create a file called <code>swish.conf</code>:</p>
<pre class="pre-section">    # Example configuration file

    # Tell Swish-e what to index (same as -i switch above)
    IndexDir /var/www/htdocs

    # Only index HTML and text files
    IndexOnly .htm .html .txt

    # Tell Swish-e that .txt files are to use the text parser.
    IndexContents TXT* .txt

    # Otherwise, use the HTML parser
    DefaultContents HTML*

    # Ask libxml2 to report any parsing errors and warnings or 
    # any UTF-8 to 8859-1 conversion errors
    ParserWarnLevel 9</pre>
<p>After saving the configuration file, reindex:</p>
<pre class="pre-section">    swish-e -c swish.conf</pre>
<p>The Swish-e configuration settings are described
in the <a href="swish-config.html">SWISH-CONFIG</a> manual page.
The order of statements in the configuration file is typically not important,
although some statements depend on previously set statements.
There are many possible settings. 
Good advice is to use as few settings as possible
when first starting out with Swish-e.</p>
<p>The runtime options (switches) are described
in the <a href="swish-run.html">SWISH-RUN</a> manual page.
You may also see a summary of options by running:</p>
<pre class="pre-section">    swish-e -h</pre>
<p>Swish-e has two other methods for reading input files.
One method uses a Perl helper script and the LWP Perl library
to spider remote web sites:</p>
<pre class="pre-section">    swish-e -S http -i http://localhost/index.html -v2</pre>
<p>This will spider the web server running on the local host.
The <code>-S</code> option defines the input source method to be "http",
<code>-i</code> specifies the URL to spider,
and <code>-v</code> sets the verbose level to two.
There are a number of configuration options
that are specific to the <code>-S</code> http input source.
See <a href="swish-config.html">SWISH-CONFIG</a>.
Note that only files of <code>Content-Type text/*</code> will be indexed.</p>
<p>The <code>-S http</code> method is deprecated, however,
in favor of a variation on the following input method.</p>
<p>There is a general-purpose input method
wherein Swish-e reads input from a program 
that produces documents in a special format.
The program might read and format data stored in a database,
or parse and format messages in a mailing list archive,
or run a program that spiders web sites (like the previous method).</p>
<p>The Swish-e distribution includes a spider program
that uses this method of input.
This spider program is much more configurable and feature-rich
than the previous (<code>-S http</code>) method.</p>
<p>To duplicate the previous example,
create a configuration file called <code>swish2.conf</code>:</p>
<pre class="pre-section">    # Example for spidering
    # Use the "spider.pl" program included with Swish-e
    IndexDir spider.pl

    # Define what site to index
    SwishProgParameters default http://localhost/index.html</pre>
<p>Then, create the index using the command:</p>
<pre class="pre-section">    swish-e -S prog -c swish2.conf</pre>
<p>This says to use the <code>-S prog</code> input source method.
Note that, in this case,
the <code>IndexDir</code> setting does not specify a file or directory to index,
but a program name to be run.
This program, <code>spider.pl</code>,
does the work of fetching the documents from the web server
and passing them to Swish-e for indexing.</p>
<p>The <code>SwishProgParameters</code> option is a special feature
that allows passing command-line parameters
to the program specified with <code>IndexDir</code>.
In this case, we are passing the word <code>default</code>
(which tells <code>spider.pl</code> to use default settings)
and the URL to spider.</p>
<p>Running a script under Windows requires specifying the interpreter
(e.g., <code>perl.exe</code>)
and then using <code>SwishPropParameters</code>
to specify the script and the script's parameters.
See <i>Notes when using <code>-S prog</code> on MS Windows</i>
on the <a href="swish-run.html">SWISH-RUN</a> page.</p>
<p>The advantage of the <code>-S prog</code> method of spidering
(over the previous <code>-S http</code> method)
is that the Perl code is only compiled once
instead of once for every document fetched from the web server.
In addition, it is a much more advanced spider with many, many features.
Still, as used here,
<code>spider.pl</code> will automatically index PDF or MS Word documents
if (when) Xpdf and Catdoc are installed.</p>
<p>A special form of the <code>-S prog</code> input source method is:</p>
<pre class="pre-section">    ./myprog --option | swish-e -S prog -i stdin -c config</pre>
<p>This allows running Swish-e from a program
(instead of running the external program from Swish-e).
So, this also can be done as:</p>
<pre class="pre-section">    ./myprog --option &gt; outfile
    swish-e -S prog -i stdin -c config &lt; outfile</pre>
<p>or</p>
<pre class="pre-section">    ./myprog --option &gt; outfile
    cat outfile | swish-e -S prog -i stdin -c config</pre>
<p>One final note about the <code>-S prog</code> input source method.
The program specified with <code>-i</code> or <code>IndexDir</code> needs to be an absolute path.
The exception is when the program is installed in the <code>libexecdir</code> directory.
Then, a plain program name may be specified
(as in the example showing <code>spider.pl</code>, above).</p>
<p>All three input source methods are described in more detail
on the <a href="swish-run.html">SWISH-RUN</a> page.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="metanames_and_properties"></a>Metanames and Properties</h2>

<p>There are two key Swish-e concepts
that you need to be familiar with: 
Metanames and Properties.</p>
<ul>
<li><a name="item_metanames"></a><a name="metanames"></a><b>Metanames</b>
<p>Swish-e creates a reverse (i.e., inverted) index.
Just like an index in a book,
you look up a word and it lists the pages (or documents)
where that word can be found.</p>
<p>Swish-e can create multiple index tables within the same index file.
For example,
you might want to create an index that only contains words in HTML titles,
so that searches can be limited to title text.
Or, you might have descriptive words
that you would like to search,
stored in a meta tag called "keywords".</p>
<p>Some database systems might call these different "fields" or "columns",
but Swish-e calls them <i>MetaNames</i>
(as a result of its first indexing HTML "meta" tags).</p>
<p>To find documents containing "foo" in their titles, you might run:</p>
<pre class="pre-section">    swish-e -w swishtitle=foo</pre>
<p>or, a more advanced example:</p>
<pre class="pre-section">    swish-e -w swishtitle=(foo or bar) or swishdefault=(baz)</pre>
<p>The Metaname "swishdefault" is the name that is used by Swish-e
if no other name is specified.
The following two searches are thus equivalent:</p>
<pre class="pre-section">    swish-e -w foo
    swish-e -w swishdefault=foo</pre>
<p>When indexing HTML documents,
Swish-e indexes words in the body and title 
under the Metaname "swishdefault".</p>
</li>
<li><a name="item_properties"></a><a name="properties"></a><b>Properties</b>
<p>Swish-e's search result is a list of files --
actually, Swish-e uses file numbers internally.
Data can be associated with each file number when indexing. 
For example, by default Swish-e associates the file's name, title,
last modified date, and size with the file number.
These items can be printed in search results.</p>
<p>In Swish-e, this associated data is called a file's <i>Properties</i>.
Properties can be any data you wish to associated with a document --
in fact, the entire text of the document can be stored in the index. 
What data is stored as a Property is controlled by the <i>PropertyNames</i>
(and other) configuration directives.</p>
<p>What properties are printed with search results
depends on the <code>-x</code> or <code>-p</code> switches.
By default,
Swish-e returns the rank, path/URL, title, and file size in bytes
for each result.</p>
</li>
</ul>

    </div>

    <div class="sub-section">
        
<h2><a name="getting_started_with_swish_e"></a>Getting Started With Swish-e</h2>

<p>Swish-e reads a configuration file (see <a href="swish-config.html">SWISH-CONFIG</a>)
for directives that control whether and how Swish-e indexes files.
Swish-e is also controlled by command-line arguments
(see <a href="swish-run.html">SWISH-RUN</a>).
Many of the command-line arguments
have equivalent configuration directives (e.g., <code>-i</code> and <code>IndexDir</code>).</p>
<p>Swish-e does not require a configuration file,
but most people change its default behavior
by placing settings in a configuration file.</p>
<p>To try the examples below,
go to the <code>tests</code> subdirectory of the distribution.
The tests will use the <code>*.html</code> files in this directory
when creating the test index.
You may wish to review these <code>*.html</code> files
to get an idea of the various native file formats that Swish-e supports.</p>
<p>You may also use your own test documents.
It's recommended to use small test documents when first using Swish-e.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="step_1_create_a_configuration_file"></a>Step 1: Create a Configuration File</h2>

<p>The configuration file controls what and how Swish-e indexes.  The
configuration file consists of directives, comments, and blank lines.
The configuration file can be any name you like.</p>
<p>This example will work with the documents in the <i>tests</i> directory.
You may wish to review the <i>tests/test.config</i> configuration file used
for the <code>make test</code> tests.</p>
<p>For example, a simple configuration file (<i>swish-e.conf</i>):</p>
<pre class="pre-section">    # Example Swish-e Configuration file

    # Define *what* to index
    # IndexDir can point to a directories and/or a files
    # Here it's pointing to the current directory
    # Swish-e will also recurse into sub-directories.
    IndexDir .

    # But only index the .html files
    IndexOnly .html

    # Show basic info while indexing
    IndexReport 1</pre>
<p>And that's a simple configuration file.
It says to index all the <code>.html</code> files
in the current directory and sub-directories, if any,
and provide some basic output while indexing.</p>
<p>As mentioned above,
the complete list of all configuration file directives
is detailed in <a href="swish-config.html">SWISH-CONFIG</a>.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="step_2_index_your_files"></a>Step 2: Index your Files</h2>

<p>Run Swish-e,
using the <code>-c</code> switch to specify the name of the configuration file.</p>
<pre class="pre-section">    swish-e -c swish-e.conf

    Indexing Data Source: "File-System"
    Indexing "."
    Removing very common words...
    no words removed.
    Writing main index...
    Sorting words ...
    Sorting 55 words alphabetically
    Writing header ...
    Writing index entries ...
      Writing word text: Complete
      Writing word hash: Complete
      Writing word data: Complete
    55 unique words indexed.
    4 properties sorted.                                              
    5 files indexed.  1252 total bytes.  140 total words.
    Elapsed time: 00:00:00 CPU time: 00:00:00
    Indexing done!</pre>
<p>This created the index file <code>index.swish-e</code>.
This is the default index file name,
unless the <b>IndexFile</b> directive is specified in the configuration file:</p>
<pre class="pre-section">    IndexFile ./website.index</pre>
<p>You may use the <code>-f</code> switch to specify a index file at indexing time.
The <code>-f</code> option overrides any <code>IndexFile</code> setting
that may be in the configuration file.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="step_3_search"></a>Step 3: Search</h2>

<p>You specify your search terms with the <code>-w</code> switch.
For example, to find the files that contain the word <code>sample</code>,
you would issue the command:</p>
<pre class="pre-section">    swish-e -w sample</pre>
<p>This example assumes that you are in the <code>tests</code> directory.
Swish-e returns the following, in response to this command:</p>
<pre class="pre-section">    swish-e -w sample

    # SWISH format: 2.4.0
    # Search words: sample
    # Number of hits: 2
    # Search time: 0.000 seconds
    # Run time: 0.005 seconds
    1000 ./test_xml.html "If you are seeing this, the METATAG XML search was successful!" 159
    1000 ./test.html "If you are seeing this, the test was successful!" 437
    .</pre>
<p>So, the word <code>sample</code> was found in two documents.
The first number shown is the relevance (or rank) of the search term,
followed by the file containing the search term,
the title of the document,
and finally, the length of the document (in bytes).</p>
<p>The period ("."), sitting alone at the end,
marks the end of the search results.</p>
<p>Much more information may be retrieved while searching,
by using the <code>-x</code> and <code>-H</code> switches (see <a href="swish-run.html">SWISH-RUN</a>)
and by using Document Properties (see <a href="swish-config.html">SWISH-CONFIG</a>).</p>

    </div>

    <div class="sub-section">
        
<h2><a name="phrase_searching"></a>Phrase Searching</h2>

<p>To search for a phrase in a document,
use double-quotes to delimit your search terms.
(The default phrase delimiter is set in <code>src/swish.h</code>.)</p>
<p>You must protect the quotes from the shell.</p>
<p>For example, under Unix:</p>
<pre class="pre-section">    swish-e -w '"this is a phrase" or (this and that)'
    swish-e -w 'meta1=("this is a phrase") or (this and that)'</pre>
<p>Or under the Windows <code>command.com</code> shell.</p>
<pre class="pre-section">    swish-e -w \"this is a phrase\" or (this and that)</pre>
<p>The phrase delimiter can be set with the <code>-P</code> switch.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="boolean_searching"></a>Boolean Searching</h2>

<p>You can use the Boolean operators <b>and</b>, <b>or</b>, or <b>not</b> in searching.
Without these Boolean operatots,
Swish-e will assume you're <b>and</b>ing the words together.</p>
<p>Here are some examples:</p>
<pre class="pre-section">    swish-e -w 'apples oranges'
    swish-e -w 'apples and oranges'  ( Same thing )

    swish-e -w 'apples or oranges'

    swish-e -w 'apples or oranges not juice' -f myIndex </pre>
<p>retrieves first the files that contain both the words "apples" and "oranges";
then among those, selects the ones that do not contain the word "juice".</p>
<p>A few other examples to ponder:</p>
<pre class="pre-section">    swish-e -w 'apples and oranges or pears'
    swish-e -w '(apples and oranges) or pears'  ( Same thing )
    swish-e -w 'apples and (oranges or pears)'  ( Not the same thing )</pre>
<p>Swish processes the query left to right.</p>
<p>See <a href="swish-search.html">SWISH-SEARCH</a> for more information.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="context_searching"></a>Context Searching</h2>

<p>The <code>-t</code> option in the search command line
allows you to search for words that exist only in specific HTML tags.
This option takes a string of characters as its argument.
Each character represents a different tag in which the word is searched;
that is, you can use any combinations of the following characters:</p>
<pre class="pre-section">    H search in all &lt;HEAD&gt; tags
    B search in the &lt;BODY&gt; tags
    t search in &lt;TITLE&gt; tags
    h is &lt;H1&gt; to &lt;H6&gt; (header) tags
    e is emphasized tags (this may be &lt;B&gt;, &lt;I&gt;, &lt;EM&gt;, or &lt;STRONG&gt;)
    c is HTML comment tags (&lt;!-- ... --&gt;)</pre>
<p>For example:</p>
<pre class="pre-section">    # Find only documents with the word "linux" in the &lt;TITLE&gt; tags.
    swish-e -w linux -t t

    # Find the word "apple" in titles or comments
    swish-e -w apple -t tc</pre>

    </div>

    <div class="sub-section">
        
<h2><a name="meta_tags"></a>META Tags</h2>

<p>As mentioned above,
Metanames are a way to define "fields" in your documents.
You can use the Metanames in your queries to limit the search
to just the words contained in that META name of your document.
For example,
you might have a META-tagged field called <code>subjects</code> in your documents.
This would let you search your documents for the word "foo",
but only return documents where "foo" is within the <code>subjects</code> META tag.</p>
<p>Document <i>Properties</i> are somewhat related:
Properties allow the content of a META tag in a source document
to be stored within the index,
and that text to be returned along with search results.</p>
<p>META tags can have two formats in your documents.</p>
<pre class="pre-section">    &lt;META NAME="keyName" CONTENT="some Content"&gt;</pre>
<p>And in XML format</p>
<pre class="pre-section">    &lt;keyName&gt;
        Some Content
    &lt;/keyName&gt;</pre>
<p>If using <i>libxml</i>, you can optionally use a non-HTML tag as a metaname:</p>
<pre class="pre-section">    &lt;html&gt;
        &lt;body&gt;
            Hello swish users!
            &lt;keyName&gt;
                this is meta data
            &lt;/keyName&gt;.
        &lt;/body&gt;</pre>
<p>This, of course, is invalid HTML.</p>
<p>To continue with our sample <code>Swish-e.conf</code> file,
add the following lines:</p>
<pre class="pre-section">    # Define META tags
    MetaNames meta1 meta2 meta3</pre>
<p>Reindex to include the changes:</p>
<pre class="pre-section">    swish-e -c swish-e.conf</pre>
<p>Now search, but this time limit your search to META tag <code>meta1</code>:</p>
<pre class="pre-section">    swish-e -w 'meta1=metatest1'</pre>
<p>Again, please see <a href="swish-run.html">SWISH-RUN</a> and <a href="swish-config.html">SWISH-CONFIG</a>
for complete documentation of the various indexing and searching options.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="spidering_and_searching_with_a_web_form_"></a>Spidering and Searching with a Web form.</h2>

<p>This example demonstrates how to spider a web site
and set up the included CGI script to provide a web-based search page.
This example uses Perl programs that are included in the Swish-e distribution:
<i>spider.pl</i> will be used for reading files from the web server;
<i>swish.cgi</i> will provide the web search form and display results.</p>
<p>As an example,
we will index the Apache Web Server documentation,
installed on the local computer at <a href="http://localhost/apache_docs/index.html">http://localhost/apache_docs/index.html</a>.</p>
<ol>
<li><a name="item_1"></a><a name="1"></a><b>1 Make a Working Directory</b>
<p>Create a directory to store the Swish-e configuration and the Swish-e index.</p>
<pre class="pre-section">    ~$ mkdir web_index
    ~$ cd web_index/
    ~/web_index$</pre>
</li>
<li><a name="item_2"></a><a name="2"></a><b>2 Create a Swish-e Configuration file</b>
<pre class="pre-section">    ~/web_index$ cat swish.conf 
    # Swish-e config to index the Apache documentation
    #
    # Use spider.pl for indexing (location of spider.pl set at installation time)
    IndexDir spider.pl

    # Use spider.pl's default configuration and specify the URL to spider
    SwishProgParameters default http://localhost/apache_docs/index.html

    # Allow extra searching by title, path
    Metanames swishtitle swishdocpath

    # Set StoreDescription for each parser
    #  to display context with search results
    StoreDescription TXT* 10000
    StoreDescription HTML* &lt;body&gt; 10000</pre>
</li>
<li><a name="item_3"></a><a name="3"></a><b>3 Generate the Index</b>
<p>Now, run Swish-e to create the index:</p>
<pre class="pre-section">    ~/web_index$ swish-e -S prog -c swish.conf 

    Indexing Data Source: "External-Program"
    Indexing "spider.pl"
    /usr/local/lib/swish-e/spider.pl: Reading parameters from 'default'

    Summary for: http://localhost/apache_docs/index.html
        Duplicates:     4,188  (349.0/sec)
    Off-site links:       276  (23.0/sec)
           Skipped:         1  (0.1/sec)
       Total Bytes: 2,090,125  (174177.1/sec)
        Total Docs:       147  (12.2/sec)
       Unique URLs:       149  (12.4/sec)
    Removing very common words...
    no words removed.
    Writing main index...
    Sorting words ...
    Sorting 7736 words alphabetically
    Writing header ...
    Writing index entries ...
      Writing word text: Complete
      Writing word hash: Complete
      Writing word data: Complete
    7736 unique words indexed.
    5 properties sorted.                                              
    147 files indexed.  2090125 total bytes.  200783 total words.
    Elapsed time: 00:00:13 CPU time: 00:00:02
    Indexing done!</pre>
<p>The above output is actually a mix of output from both Swish-e
and <code>spider.pl</code>.
<code>spider.pl</code> reports the
"Summary for: <a href="http://localhost/apache_docs/index.html">http://localhost/apache_docs/index.html</a>".</p>
<p>Also note that Swish-e knows to find <code>spider.pl</code>
at <code>/usr/local/lib/swish-e/spider.pl</code>.
The script installation directory (called <code>libexecdir</code>)
is set at configure time.
You can see your setting by running <code>swish-e -h</code>:</p>
<pre class="pre-section">    ~/web_index$ swish-e -h | grep libexecdir
     Scripts and Modules at: (libexecdir) = /usr/local/lib/swish-e</pre>
<p>This directory will be needed in the next step,
when setting up the CGI script.</p>
<p>Finally, verify that the index can be searched from the command line:</p>
<pre class="pre-section">    ~/web_index$ swish-e -w installing -m3
    # SWISH format: 2.4.0
    # Search words: installing
    # Removed stopwords: 
    # Number of hits: 17
    # Search time: 0.018 seconds
    # Run time: 0.050 seconds
    1000 http://localhost/apache_docs/install.html "Compiling and Installing Apache" 17960
    718 http://localhost/apache_docs/install-tpf.html "Installing Apache on TPF" 25734
    680 http://localhost/apache_docs/windows.html "Using Apache with Microsoft Windows" 27165
    .</pre>
<p>Now, try limiting the search to the title:</p>
<pre class="pre-section">    ~/web_index$ swish-e -w swishtitle=installing -m3 
    # SWISH format: 2.3.5
    # Search words: swishtitle=installing
    # Removed stopwords: 
    # Number of hits: 2
    # Search time: 0.018 seconds
    # Run time: 0.048 seconds
    1000 http://localhost/apache_docs/install-tpf.html "Installing Apache on TPF" 25734
    1000 http://localhost/apache_docs/install.html "Compiling and Installing Apache" 17960
    .</pre>
<p>Note that the above can also be done using the <code>-t</code> option:</p>
<pre class="pre-section">    ~/web_index$ swish-e -w installing -m3 -tH</pre>
</li>
<li><a name="item_4"></a><a name="4"></a><b>4 Set up the CGI script</b>
<p>Swish-e does not include a web server.
So, you must use your locally installed web server.
Apache is highly recommended, of course.</p>
<p>Locate your web server's CGI directory.
This may be a <code>cgi-bin</code> directory in your home directory
or a central <code>cgi-bin</code> directory set up by the web server administrator.
Once this is located,
copy the <code>swish.cgi</code> script into the <code>cgi-bin</code> directory.</p>
<p>Where CGI scripts can be located
depends completely on the web server that is being used
and how it has been configured.
See your web server's documentation or your site's administrator
for additional information.</p>
<p>This example will use a site <code>cgi-bin</code> directory,
located at <code>/usr/lib/cgi-bin</code>. 
Copy the <code>swish.cgi</code> script into the <code>cgi-bin</code> directory.
Again, we will need the location of the <code>libexecdir</code> directory:</p>
<pre class="pre-section">    ~/web_index$ swish-e -h | grep libexecdir
     Scripts and Modules at: (libexecdir) = /usr/local/lib/swish-e

    ~/web_index$ cd /usr/lib/cgi-bin
    /usr/lib/cgi-bin$ su
    Password: 
    /usr/lib/cgi-bin# cp /usr/local/lib/swish-e/swish.cgi.</pre>
<p>If your operating system supports symbolic links
<b>and</b> your web server allows programs to be symbolic links,
then you may wish to create a link to the <code>swish.cgi</code> program, instead.</p>
<pre class="pre-section">    /usr/lib/cgi-bin# ln -s /usr/local/lib/swish-e/swish.cgi</pre>
<p>We need to tell the <code>swish.cgi</code> script where to look
for the index created in the previous step.
It's also recommended to enter the path to the swish-e binary.
Otherwise, the <code>swish.cgi</code> script will look for the binary in the <code>PATH</code>,
and that may change when running under the CGI environment.</p>
<p>Here's the configuration file:</p>
<pre class="pre-section">    /usr/lib/cgi-bin# cat .swishcgi.conf 
    return {
        title        =&gt; 'Search Apache Documentation',
        swish_binary =&gt; '/usr/local/bin/swish-e',
        swish_index  =&gt; '/home/moseley/web_index/index.swish-e',
    }</pre>
<p>Now, test the script from the command line (as a normal user!):</p>
<pre class="pre-section">    /usr/lib/cgi-bin# exit
    exit

    /usr/lib/cgi-bin$  ./swish.cgi | head
    Content-Type: text/html; charset=ISO-8859-1

    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
    &lt;html&gt;
        &lt;head&gt;
           &lt;title&gt;
              Search Apache Documentation
           &lt;/title&gt;
        &lt;/head&gt;
        &lt;body&gt;</pre>
<p>Notice that the CGI script returns the HTTP header (Content-Type)
and the body of the web page,
just like a well behaved CGI scrip should do.</p>
<p>Now, test using the web server
(this step depends on the location of your <code>cgi-bin</code> directory).
This example uses the "GET" command that is part of the LWP Perl library,
but any web browser can run this test.</p>
<pre class="pre-section">    /usr/lib/cgi-bin$ GET http://localhost/cgi-bin/swish.cgi | head
    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Tranitional//EN"&gt;
    &lt;html&gt;
        &lt;head&gt;
           &lt;title&gt;
              Search Apache Documentation
           &lt;/title&gt;
        &lt;/head&gt;
        &lt;body&gt;
            &lt;h2&gt;</pre>
<p>The script reports errors to stderr,
so consult the web server's error log if problems occur.
The message "Service currently unavailable",
reported by running <code>swish.cgi</code>,
typically indicates a configuration error;
the exact problem will be listed in the web server's error log.</p>
<p>Detailed instructions on using the <code>swish.cgi</code> script
and debugging tips can be found by running:</p>
<pre class="pre-section">    $ perldoc swish.cgi</pre>
<p>while in the <code>cgi-bin</code> directory where <code>swish.cgi</code> was copied.  </p>
<p>The spider program <code>spider.pl</code> also has a large number
of configuration options.</p>
<p>Documentation is also available
in the directory <code>$prefix/share/doc/swish-e</code> or at
<a href="http://swish-e.org">http://swish-e.org</a>.</p>
<p>Note: Also check out the <code>search.cgi</code> script,
found at the same location as the <code>swish.cgi</code> script.
This is more of a skeleton script,
for those that want to create a custom search script.</p>
</li>
</ol>
<p>Now you are ready to search.</p>

    </div>

    <div class="sub-section">
        
<h1><a name="indexing_other_types_of_documents_filtering"></a>Indexing Other Types of Documents - Filtering</h1>

<p>Swish-e can only index HTML, XML, and text documents.
In order to index other documents,
such as PDF or MS Word documents,
you must use a utility to convert or "filter" those documents.</p>
<p>How documents are filtered with Swish-e has changed over time.
This has resulting in a bit of confusion.
It's also a somewhat complex process,
as different programs need to communicate with each other.</p>
<p>You may wish to read the Swish-e FAQ question on filtering,
before continuing here.
<a href="swish-faq.html#how_do_i_filter_documents_">How do I filter documents?</a></p>

    </div>

    <div class="sub-section">
        
<h2><a name="filtering_overview"></a>Filtering Overview</h2>

<p>There are two ways to filter documents with Swish-e.
Both are described in the <a href="swish-config.html">SWISH-CONFIG</a> man page.
They use the <code>FileFilter</code> directive
and the <code>SWISH::Filter</code> Perl module.</p>
<p>The <code>FileFilter</code> directive is a general-purpose method of filtering.
It allows running of an external program for each document processed
(based on file extension),
and requires one or more external programs.
These programs open an input file, convert as needed,
and write their output to standard output.  </p>
<p>Previous versions of Swish-e (before 2.4.0)
used a collection of filter programs
for converting files such as PDF or MS Word documents.
The external programs call other program to do the work of filtering
(e.g. <i>pdftotext</i> to extract the contents from PDF files).
Although these filter programs are still included
with the Swish-e distribution as examples,
it is recommended to use the <code>SWISH::Filter</code> method, instead.</p>
<p>One disadvantage of using <code>FileFilter</code>
is that the filter program is run once
for every document that needs to be filtered.
This can slow down the indexing process <b>substantially</b>.</p>
<p>The <code>SWISH::Filter</code> Perl module works very much like the old system
and uses the same helper programs.
Convieniently, however,
it provides a single interface for filtering all types of documents.
The primary advantage of <code>SWISH::Filter</code>
is that it is built into the program used for spidering web sites (spider.pl),
so all that's required is installing the filter programs that do the
actual work of filtering (e.g. <i>catdoc</i>, <i>xpdf</i>).
(The Windows binary includes some of the filter programs.)</p>
<p>But, Swish-e will not use <code>SWISH::Filter</code> by default
when using the file system method of indexing.
To use <code>SWISH::Filter</code> when indexing by file system method (-S fs),
you can use a <code>FileFilter</code> directive with the <code>swish_filter.pl</code> filter
(which is just a program that uses <code>SWISH::Filter</code>)
or use the <code>-S prog</code> method of indexing
and use the <code>DirTree.pl</code> program for fetching documents.</p>
<p><code>DirTree.pl</code> is included with the Swish-e distribution
and is designed to work with <code>SWISH::Filter</code>.
Using DirTree.pl will likely be a faster way to index,
since the <code>SWISH::Filter</code> set of modules
does not need to be compiled for every document
that needs to be filtered.</p>
<p>See the contents of <code>swish_filter.pl</code> and <code>DirTree.pl</code>
for specifics on their use.</p>

    </div>

    <div class="sub-section">
        
<h2><a name="filtering_examples"></a>Filtering Examples</h2>

<p>The <code>FileFilter</code> directive can be used in your config file
to convert documents, based on their extensions.
This is the old way of filtering,
but provides an easy way to add filters to Swish-e.</p>
<p>For example:</p>
<pre class="pre-section">    FileFilter .pdf  pdftotext   "'%p' -"
    IndexContents TXT* .pdf</pre>
<p>will cause all <code>.pdf</code> files to be filtered through the <i>pdftotext</i> program
(part of the <i>Xpdf</i> package)
and to parse the resulting output (from <i>pdftotext</i>)
with the text ("TXT") parser.</p>
<p>The other way to filter documents
is to use a <code>-S prog</code> prograam
and convert the documents before passing them onto Swish-e.</p>
<p>For example, <code>spider.pl</code> makes use of the <code>SWISH::Filter"</code> Perl module,
included with the Swish-e distribution.
<code>SWISH::Filter</code> is passed a document and the document's content type;
it looks for modules and utilities to convert the document
into one of the types that Swish-e can index.</p>
<p>Swish-e comes ready to index PDF, MS Word, MP3 ID3 tags,
and MS Excel file types.
But these filters need extra modules or tools to do the actual conversion.</p>
<p>For example, the Swish-e distribution includes a module called 
<code>SWISH::Filter::Pdf2HTML</code>
that uses the <i>pdftotext</i> and <i>pdfinfo</i> utilities
provided by the <i>Xpdf</i> package.</p>
<p>This means that if you are using <code>spider.pl</code>
to spider your web site
and you wish to index PDF documents,
all that is needed is to install the Xpdf package
and Swish-e (with the help of spider.pl) will begin indexing your PDF files.</p>
<p>Ok, so what does all that mean?
For a very simple site,
you should be able to run this:</p>
<pre class="pre-section">    $ /usr/local/lib/swish-e/spider.pl default http://localhost/ | swish-e -S prog -i stdin</pre>
<p>which is running the spider with default spider settings,
indexing the Web server on localhost,
and piping its output into Swish-e (using the default indexing settings).
Documents will be filtered automatically,
if you have the required helper applications installed.</p>
<p>Most people will not want to just use the default settings
(for one thing, the spider will take a while
because its default is to delay a few seconds between every request).
So, read the documentation for <code>spider.pl</code>,
to learn how to use a spider config file.
Also read  <a href="swish-config.html">SWISH-CONFIG</a>
to learn about what configuration options can be used with Swish-e.</p>
<p>The <code>SWISH::Filter</code> documentation provides more details on filtering
and hints for debugging problems when filtering. </p>

    </div>

    <div class="sub-section">
        
<h1><a name="document_info"></a>Document Info</h1>

<p>$Id: INSTALL.pod 1978 2007-12-08 01:59:17Z karpet $</p>
<p>.</p>

    </div>















        </div><!-- /#main-copy  -->

    </div><!-- /#content-area -->


    <div id="side-bar">
        <!-- noindex -->
<ul class="menu"><li class="menuparent">

    <a class="menu" 
    href="./index.html"
    >Doc Overview</a>

<!-- noindex -->
<ul class="submenu"><li class="">

    <a class="submenu" 
    href="./readme.html"
     title="First time users">README</a>

</li><li class="">

    <a class="thisfile" 
    href="./install.html"
     title="Installation and usage overview">Install &#187;</a>

</li><li class="">

    <a class="submenu" 
    href="./changes.html"
     title="Important changes from previous versions">Changes</a>

</li><li class="">

    <a class="submenu" 
    href="./swish-config.html"
     title="Directives that go in your Swish-e configuration file">Configuration</a>

</li><li class="">

    <a class="submenu" 
    href="./swish-run.html"
     title="Command line options for Swish-e binary">Running</a>

</li><li class="">

    <a class="submenu" 
    href="./swish-search.html"
     title="Swish-e's search language">Searching</a>

</li><li class="">

    <a class="submenu" 
    href="./swish-faq.html"
    >FAQ</a>

</li><li class="">

    <a class="submenu" 
    href="./swish-bugs.html"
    >Known issues</a>

</li><li class="">

    <a class="submenu" 
    href="./swish-3.0.html"
    >The Future</a>

</li><li class="">

    <a class="submenu" 
    href="./swish-library.html"
     title="Swish-e C API">C API</a>

</li><li class="">

    <a class="submenu" 
    href="./api.html"
     title="Perl interface to the Swish-e library">Perl API</a>

</li><li class="">

    <a class="submenu" 
    href="./swish.cgi.html"
     title="Example CGI/mod_perl script">Swish.cgi</a>

</li><li class="">

    <a class="submenu" 
    href="./search.cgi.html"
     title="Example Perl script using SWISH::API">Search.cgi</a>

</li><li class="">

    <a class="submenu" 
    href="./spider.html"
     title="The Swish-e HTTP spider">Spider.pl</a>

</li><li class="">

    <a class="submenu" 
    href="./filter.html"
     title="How to index non-text documents">Filters</a>

</li></ul>
<!-- index -->


</li></ul>
<!-- index -->



    </div><!-- /#side-bar -->


</div><!-- /#body-area -->



<div id="footer">
    <!-- noindex -->
<span class="doNotPrint">
    Swish-e is distributed with <strong>no warranty</strong> under the terms of the <br />
    <a href='http://swish-e.org/license.html'>Swish-e License</a>.<br />
    Questions may be posted to the 
    <a href="http://swish-e.org/discuss.html" title="email list and list archive">Swish-e Discussion list</a>.
</span>



<p>
    <strong>URI &raquo;</strong> http://swish-e.org/ 
    &bull;

    <strong>Generated &raquo;</strong>Sun, 05 Apr 2009 02:02:25 UTC</p>
<!-- index -->

</div><!-- /#footer -->


</body>
</html>