Simple Web Indexing for Humans - Enhanced

Aus Mikiwiki
Wechseln zu: Navigation, Suche

Simple Web Indexing for Humans - Enhanced / SWISH-E (auch: Swish-e) wird zum Indexieren von Sammlungen von bis zu einer Million Dokumenten eingesetzt und enthält Importfilter für viele Dokumenttypen.

Installation

Vorbedingungen: libxml2, libxml2-devel, zlib, xpdf, catdoc [1]

# cd /tmp
# tar xzf catdoc-0.93.3.tar.gz
# cd catdoc-0.93.3
# ./configure
# make
# checkinstall
# rpm -i /usr/src/packages/RPMS/i386/catdoc-0.93.3-1.i386.rpm
# ldconfig

Installation von swish-e

$ tar xzf swish-e-2.4.2.tar.gz
$ cd swish-e-2.4.2
$ ./configure
$ make
$ make check
...
All 3 tests passed
...
$ su root
# checkinstall
# rpm -i /usr/src/packages/RPMS/i386/swish-e-2.4.2-1.i386.rpm
# exit
$ swish-e -V
SWISH-E 2.4.2

Anlegen der Konfigurationsdatei "swish.conf"

# What to index (same as -i switch)
IndexDir /home/mik/public_html/local
#
# Only index HTML and text files
IndexOnly .htm .html .txt
#
# Tell swish that .txt files are to use the text parser.
IndexContents TXT* .txt
#
# PDF
IndexContents TXT* .pdf
FileFilter .pdf "/usr/bin/pdftotext" "'%p' -"
#
# Kommentiertes jpeg
#IndexContents TXT* .jpg
#FileFilter rdjpgcom $1
#
# Otherwise, use the HTML parser
DefaultContents HTML*
#
# Show basic info while indexing
IndexReport 1

Installation der Web-Schnittstelle

$ mkdir /home/mik/.swish
$ cd /home/mik/.swish
$ ln -s /usr/local/lib/swish-e/swish.cgi swish.cgi

Anlegen einer Konfigurationsdatei:
$ vi swish.conf
IndexDir /usr/share/doc
IndexOnly .html .htm
DefaultContents HTML*
StoreDescription HTML* <body> 200000
MetaNames swishdocpath swishtitle
ReplaceRules remove /usr/share/

Anlegen eines Index:
$ swish-e -c swish.conf
$ swish-e -w install -m 1
$ ls -1

Testen des CGI-Skripts.

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
       <title>
          Search our site
       </title>
    </head>
    <body>

Testen mit dem Webserver.

$ su -c "ln -s /home/mik/.swish/ /srv/www/htdocs/swish"
Password:

If your account is on an ISP and your web directory is ~/public_html the you might just move the entire directory:
mv ~/.swish ~/public_html

$ cd /home/mik/.swish
$ wget -O - http://localhost/swishdir/swish.cgi | head
oder
$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /swish/swish.cgi http/1.0

Anpassung von .htaccess:
$ cd /home/mik/.swish
$ vi .htaccess
# Deny everything by default
Deny From All
# But allow just CGI script
<files swish.cgi>
  Options ExecCGI
  Allow From All
  SetHandler cgi-script
</files>

Anpassung von httpd.conf und Apache-Neustart:
# vi /etc/httpd/httpd.conf
Bei "FollowSymLinks" Miuszeichen entfernen
Unter <Directory "/srv/www/htdocs"> das Wort ExecCGI einfügen
# /etc/init.d/apache restart

$ cd /home/mik/.swish
$ ln -s /usr/share/doc

Verwendung

Indexieren aller Dateien unter "/home/mik", wobei im aktuellen Verzeichnis ein Index "index.swish.e" angelegt wird.

$ swish-e -i /home/mik

Im angelegten Index nach einem Wort suchen.

$ swish-e -w apache

Erneutes Indizieren nach Änderung von "swish.conf".

$ swish-e -c swish.conf

Indizieren einer Seite im Internet (nur Dateien vom "Content-Tyoe text/*").

$ swish-e -S http -i http://localhost/index.html -v2

Weblinks