Dernière modification 8 août 2005
Ht://Dig tourne aussi sous Windows avec un serveur apache, pour cela voir ma page correspondante.
tar xvfz htdig-3.1.6.tar.gz
Cela va créer un répertoire htdig-3.1.6 dans lequel on tapera configure avec les options suivantes :
./configure --prefix=/chemin-d-install --with-cgi-bin-dir=chemin-cgi-apache --with-image-dir=répertoire-contenant-image --with-search-dir=répertoire-contenant-script-recherche
Voilà la commande que j'ai tapée chez moi après avoir créé préalablement le répertoire /usr/local/apache/htdocs/htdig :
./configure --prefix=/usr/local/htdig --with-cgi-bin-dir=/usr/local/apache/cgi-bin --with-image-dir=/usr/local/apache/htdocs/htdig --with-search-dir=/usr/local/apache/htdocs/htdig
Je ne passais pas cette étape avec la Mandrake 7.1 pour une sombre histoire de headers C++ . Puis
make
Et enfin en tant que root
make install
Cela va mettre en place un fichier htsearch dans le
répertoire
cgi-bind'apache et rajoutez un script de recherche sous
le
répertoirehtdocs/htdigd'apache dont on verra
l'utilité
plus tard. Les binaires sont sous /usr/local/htdig/bin, le
fichier
de conf sous /usr/local/htdig/confet les bases de
données sous
/usr/local/htdig/db.
# définition de l'emplacement où se trouveront les
bases
de données sur le site intranet
# attention, elles peuvent être assez grosses, pour info pour
mon
site intranet contenant mes pages
# www.funix.org les bases font un total de 12Mo !
# avec une install par rpm le chemin est /var/lib/htdig
database_dir:
/usr/local/htdig/db
# Définition de l'adresse à partir de laquelle
htdig doit
construire ses bases de données
# mettez ici l'URL de votre intranet
# vous pouvez éventuellement mettre l'URL de n'importe quel
site
sur internet
start_url:
http://www.funix.kervao.fr/
# votre site peut contenir des liens vers des sites
extérieurs,
cette variable permet de
# limiter la rechercher à des pages de votre domaine
limit_urls_to:)
${start_url}
# Définition des pages à ne pas indexer, ce sont
donc
celles qui sont dans
# http://www.funix.kervao.fr/cgi-bin par exemple ici
exclude_urls:%)
/cgi-bin/
.cgi
# fichiers qui seront ignorés pendant l'indexation
bad_extensions: .wav
.gz
.z .sit .au .zip .tar .hqx .exe .com .gif \
.jpg .jpeg .aiff .class .map .ram .tgz .bin .rpm .mpg .mov .avi
# adresse email de l'administrateur
maintainer:
olivier@kervao.fr
# Par défaut un extrait de chaque page est archivé
dans
la base, vous pouvez limiter
# évidemment cette taille
max_head_length: 10000
# si vous récupérez des pages sur internet
(indexation
de sites sur internet) vous pouvez aussi
# limiter la taille des pages à récupérer
max_doc_size:%)
200000
#
# Most people expect some sort of excerpt in results. By default, if
the
# search words aren't found in context in the stored excerpt,
htsearch
shows
# the text defined in the no_excerpt_text attribute:
# (None of the search words were found in the top of this document.)
# This attribute instead will show the top of the excerpt.
#
no_excerpt_show_top: true
#
# Depending on your needs, you might want to enable some of the
fuzzy
search
# algorithms. There are several to choose from and you can use
them
in any
# combination you feel comfortable with. Each algorithm will
get
a weight
# assigned to it so that in combinations of algorithms, certain
algorithms
get
# preference over others. Note that the weights only affect
the
ranking of
# the results, not the actual searching.
# The available algorithms are:
# exact
# endings
# metaphone
# prefix
# soundex
# synonyms
# By default only the "exact" algorithm is used with weight 1.
# Note that if you are going to use the endings, metaphone, soundex,
# or synonyms algorithms, you will need to run htfuzzy to generate
# the databases they use.
#
search_algorithm: exact:1
synonyms:0.5
endings:0.1
#
# The following are the templates used in the builtin search results
# The default is to use compiled versions of these files, which
produces
# slightly faster results. However, uncommenting these lines makes it
# very easy to change the format of search results.
# See <http://www.htdig.org/hts_templates.html for more details.
#
# template_map: Long long ${common_dir}/long.html \
#
Short short ${common_dir}/short.html
# template_name: long
#
# The following are used to change the text for the page index.
# The defaults are just boring text numbers. These images spice
# up the result pages quite a bit. (Feel free to do whatever,
though)
#
next_page_text:
<img
src="/htdig/buttonr.gif" border="0" align="middle"
width="30" height="30" alt="next">
no_next_page_text:
prev_page_text:
<img
src="/htdig/buttonl.gif" border="0" align="middle"
width="30" height="30" alt="prev">
no_prev_page_text:
page_number_text: '<img
src="/htdig/button1.gif"
border="0" align="middle" width="30" height="30" alt="1">' \
'<img src="/htdig/button2.gif" border="0" align="middle" width="30"
height="30"
alt="2">' \
'<img src="/htdig/button3.gif" border="0" align="middle" width="30"
height="30"
alt="3">' \
'<img src="/htdig/button4.gif" border="0" align="middle" width="30"
height="30"
alt="4">' \
'<img src="/htdig/button5.gif" border="0" align="middle" width="30"
height="30"
alt="5">' \
'<img src="/htdig/button6.gif" border="0" align="middle" width="30"
height="30"
alt="6">' \
'<img src="/htdig/button7.gif" border="0" align="middle" width="30"
height="30"
alt="7">' \
'<img src="/htdig/button8.gif" border="0" align="middle" width="30"
height="30"
alt="8">' \
'<img src="/htdig/button9.gif" border="0" align="middle" width="30"
height="30"
alt="9">' \
'<img src="/htdig/button10.gif" border="0" align="middle" width="30"
height="30"
alt="10">'
# To make the current page stand out, we will put a border
arround the
# image for that page.
#
no_page_number_text: '<img
src="/htdig/button1.gif"
border="2" align="middle" width="30" height="30" alt="1">' \
'<img src="/htdig/button2.gif" border="2" align="middle" width="30"
height="30"
alt="2">' \
'<img src="/htdig/button3.gif" border="2" align="middle" width="30"
height="30"
alt="3">' \
'<img src="/htdig/button4.gif" border="2" align="middle" width="30"
height="30"
alt="4">' \
'<img src="/htdig/button5.gif" border="2" align="middle" width="30"
height="30"
alt="5">' \
'<img src="/htdig/button6.gif" border="2" align="middle" width="30"
height="30"
alt="6">' \
'<img src="/htdig/button7.gif" border="2" align="middle" width="30"
height="30"
alt="7">' \
'<img src="/htdig/button8.gif" border="2" align="middle" width="30"
height="30"
alt="8">' \
'<img src="/htdig/button9.gif" border="2" align="middle" width="30"
height="30"
alt="9">' \
'<img src="/htdig/button10.gif" border="2" align="middle" width="30"
height="30"
alt="10">'
# local variables:
# mode: text
# eval: (if (eq window-system 'x) (progn (setq font-lock-keywords
(list
'("^#.*" . font-lock-keyword-face) '("^[a-zA-Z][^ :]+" .
font-lock-function-name-face)
'("[+$]*:" . font-lock-comment-face) )) (font-lock-mode)))
# end:
A noter qu'avec une installation par rpm le fichier est automatiquement renseigné d'après le fichier de configuration d'apache. On trouvera en fin de fichier
# Automatically set up by htdig RPM, from your current Apache
httpd.conf...
# Verify and configure these, and set maintainer above, before
running
# /usr/bin/rundig.
# See /usr/doc/htdig*/attrs.html for descriptions of attributes.
# The URL(s) where htdig will start. See also limit_urls_to
above.
start_url: http://asterix.kervao.fr
# This makes sure that we don't spider the web
local_urls_only: true
# These attributes allow indexing server via local filesystem
rather
than HTTP.
local_urls:
http://asterix.kervao.fr/=/var/www/html/
local_user_urls:
http://asterix.kervao.fr/=/home/,/public_html/
A modifier selon votre convenance. On va maintenant explorer le site web et récupérer les pages en tapant
/usr/local/htdig/bin/htdig -ivs
Note : Taper /usr/bin/htdig -ivs pour une install par rpm, si ça ne marche pas supprimez les dernières lignes local_urls_only, local_urls et local_user_urls.
Ne vous inquiétez pas si votre site est écrit en PHP,
ça
marche aussi très bien.
L'option -i permet d'effacer les recherches
précédentes
et de repartir de zéro, l'option -v est l'option
"verbeuse".
On crée à présent l'index en tapant :
/usr/local/htdig/bin/htmerge -vs
Pour info avec l'option -m les tables sont simplement mises à niveau.
Pour une installation avec rpm la syntaxe est un peu différente, vous devez taper:
/usr/bin/htmerge -v -m /etc/htdig/htdig.conf
Ce sera la même commande à taper pour une mise à
jour.
Suivant la taille du site, la commande peut être plus ou moins
longue.
URL: http://www.funix.kervao.fr/htdig/search.html
(Pour une install avec rpm, vous pouvez omettre le search.html)

Voilà le résultat de la recherche

Les pages sont classées suivant qu'elles collent plus ou moins avec la recherche, mais vous pouvez éventuellement modifier le type de tri (Sort by). Pour info on utilise un modèle de présentation des résultats se trouvant sous /usr/local/htdig/common (/usr/share/htdig pour une installation avec rpm) avec
header.html qui précède la liste des
résultats
footer.html qui suit la liste des résultats
nomatch.html quand on ne trouve rien
syntax.html en cas d'erreur de syntaxe
wrapper.html entête et pied de page
| [Retour page d'accueil FUNIX] | [Retour haut de la page] |