ht//Dig est un moteur de recherche gratuit qui permet d'indexer votre site Web. Cette page décrit son installation et sa configuration pour MacOS X.
Par rapport à la version de base, j'ai légèrement modifié les scripts afin de pouvoir gérer plusieurs instance de ce moteur sur plusieurs partie d'un site ou plusieurs site sur une même machine.
Récupérer une version d'ht//Dig, par exemple à l'adresse <http://www.htdig.org/>. Vous allez obtenir le fichier htdig-3.1.6.tar.gz
que vous décompressez. (Double-clic dessus devrait lancer StuffIt Expander). Vous devez avoir un répertoire htdig-3.1.6
.
Afin de permettre de faire les installations sans mot de passe 'root', je fais l'installation dans le répertoire /Library/WebServer/htdig
.
En administrateur :
En utilisateur :
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
...
creating config.h
Now you must run 'make' followed by 'make install'
En utilisateur :
gcc -c -O -I. -I./../include ../btree/bt_compare.c
...
c++ -c -DSENDMAIL=\"/usr/sbin/sendmail\" -DDEFAULT_CONFIG_FILE=\"/Library/WebServer/htdig/conf/htdig.conf\" -I../htlib -I../htcommon -I../db/dist -I../include -g -O2 htnotify.cc
c++ -o htnotify -L../htlib -L../htcommon -L../db/dist -L/usr/lib EmailNotification.o htnotify.o ../htcommon/libcommon.a ../htlib/libht.a ../db/dist/libdb.a -lz
make[1]: Nothing to be done for `all'.
Installing ht://Dig
Creating directories (if needed)...
mkdir /Library/WebServer/htdig/bin
...
Installing images...
Creating rundig script...
Installation done.
Before you can start searching, you will need to create a
search database. A sample script to do this has been
installed as /Library/WebServer/htdig/bin/rundig
Executer la commande rundig afin de créer la première base.
Le serveur web s'exécute au nom de l'utilisateur web. Il faut donc que le script CGI et les répertoires qu'il utilise soient accessibles à l'utilisateur web. Il faut donc donner les droits à l'utilisateur web (qui fait aussi partie du groupe web).
sudo chown web:web /Library/WebServer/CGI-Executables/htsearch
sudo chown -R web:web /Library/WebServer/htdig
Pour permettre d'utiliser plusieurs moteurs de recherche sur un même site, j'ai rajouté une variable sub_index
dans le fichier de configuration (htdig.conf
).
Exemple :
sub_index: I-LIP6
database_dir: /Library/WebServer/htdig/db/${sub_index}
template_map: Long long ${common_dir}/${sub_index}/long.html \
Court short ${common_dir}/${sub_index}/short.html
search_results_footer: ${common_dir}/${sub_index}/footer.html
search_results_header: ${common_dir}/${sub_index}/header.html
nothing_found_file: ${common_dir}/${sub_index}/nomatch.html
syntax_error_file: ${common_dir}/${sub_index}/syntax.html
À partir de maintenant, vous pouvez aller à l'adresse /cgi-bin/htsearch
de votre site web mais vous obtenez:
ht://Dig error
htsearch detected an error. Please report this to the webmaster of this site. The error message is:
Unable to read configuration file
Il faut créer les répertoires correspondant à ${sub_index}
.
mkdir /Library/WebServer/htdig/db/I-LIP6/
mkdir /Library/WebServer/htdig/common/I-LIP6/
Reprendre ce qui est expliqué ici <http://didier.quartier-rural.org/elucu/htdig-vf/lisezmoi.html>.
Après avoir mis les fichiers bad_words.fr
, francais.0
, francais.aaf
, synonyms.fr
dans le dossier common
.
Modifier le fichier htdig.conf
avec
# ----- debut de francisation -----
# search_algorithm: exact:1 synonyms:0.5 endings:0.1
#
# Algorithme de recherche avec équivalence caractères accentués/non-accentués
#
search_algorithm: exact:1 accents:0.7 synonyms:0.3 endings:0.1
locale: fr_FR
date_format: %d %b %Y
valid_punctuation: ._/!#$%^&
# Libellés divers:
boolean_keywords: et ou pas
boolean_syntax_errors: Attendait "un mot" "à la fin" "au lieu de" "fin d'expression"
method_names: and 'Tous les mots' or 'Un des mots' boolean Booléen
template_map: Long builtin-long builtin-long Court builtin-short builtin-short
sort_names: score 'Score décroissant' time 'Date décroissante' title Titre revscore 'Score croissant' revtime 'Date croissante' revtitle 'Titre alpha inverse'
no_excerpt_text: <em>(Aucun des mots recherchés n'a été trouvé dans l'entête de ce document)</em>
# Fichiers de langues:
endings_dictionary: ${common_dir}/francais.0
endings_affix_file: ${common_dir}/francais.aff
bad_word_list: ${common_dir}/bad_words.fr
synonym_dictionary: ${common_dir}/synonyms.fr
# ----- fin de francisation -----
Récupérer <http://users.phg-online.de/tk/MOSXS/xpdf-tools-3.dmg>
J'ai mis les fichier issus de xpdf-tools-3.dmg dans /Library/WebServer/htdig/bin/
(./configure --prefix=/Library/WebServer/htdig)
Remplacer les première lignes de doc2html.pl
et pdf2html.pl
par
#!/usr/bin/perl -w
Dans doc2html.pl
:
my $PDF2HTML = '/Library/WebServer/htdig/scripts/pdf2html.pl';
Dans pdf2html.pl
:
my $PDFTOTEXT = "/Library/WebServer/htdig/bin/pdftotext";
my $PDFINFO = "/Library/WebServer/htdig/bin/pdfinfo";
Dans les fichier de configuration d'htdig (htdig.conf
), augmenter le max_doc_size
de façon a indexer les fichiers PDF assez gros.
max_doc_size: 1000000
Récupérer <http://www.htdig.org/files/contrib/parsers/doc2html_31.zip>
J'ai mis les fichiers issus de doc2html_31.zip
dans un dossier /Library/WebServer/htdig/scripts/
Pour catdoc-0.93.4 :
./configure --prefix=/Library/WebServer/htdig
make
Le make install
ne marche pas. Il faut aller dans src
pour faire le make install
qui va ne recopier que les binaires, dans charsets
pour recopier les fichiers d'encodage de texte sinon on obtient : Cannot load charset cp1251 - file not found
.
cd /Library/WebServer/catdoc-0.93.4/src
make install
cd /Library/WebServer/catdoc-0.93.4/charsets
make install
cd /Library/WebServer/catdoc-0.93.4/doc
make install
Dans doc2html.pl
:my $PDF2HTML = '';
par
my $CATDOC = '/Library/WebServer/htdig/bin/catdoc';
my $CATXLS = '/Library/WebServer/htdig/bin/xls2csv';
Dans les fichier de configuration d'htdig (htdig.conf
), ajouter :
external_parsers: application/rtf->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
text/rtf->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/pdf->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/postscript->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/msword->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/wordperfect5.1->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/wordperfect6.0->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/msexcel->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/vnd.ms-excel->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/vnd.ms-powerpoint->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/powerpoint->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/x-shockwave-flash->text/html /Library/WebServer/htdig/scripts/doc2html.pl \
application/x-shockwave-flash2-preview->text/html /Library/WebServer/htdig/scripts/doc2html.pl
À faire les fichiers PowerPoint.
2004-2005
|