#!/usr/bin/perl -w use strict; # run with -v to enable the verbose mode for Swish-e # -v 1 just summary # -v 2 list docs processed # -v 3 more detail # # run with -E to make swish send warnings and errors to stderr. # *Note: not implemented in this script at this time requires swish-e 2.2.1. # # You can also enable debugging for the spider (that fetches the docs for Swish). # For example: # SPIDER_DEBUG=url ../../bin/makeindex -v2 # # Note that using "skipped" will show that all files are skipped. That's # because the spider config file splits the docs into sections and feeds # those sections directly to swish for indexing. This bypasses the normal # mode of just indexing full files. my %opts; use Getopt::Std; #getopt('vE', \%opts); getopt('v', \%opts); # does the indexing process # relies on setting of the following env varibles: # # the root of the site, without the trailing / # export MODPERL_SITE='http://localhost/modperl-site' # # the location of the swish-e, we need it to be set explicitly, # because on some machines, more than one version exists, and we need # the 2.1-dev + version # $ENV{SWISH_BINARY_PATH} = "/usr/local/bin/swish-e"; # # both can be set in the user's startup file BEGIN { require Sys::Hostname; my $hostname = Sys::Hostname::hostname(); if ($hostname && ($hostname eq 'minotaur.apache.org')) { $ENV{MODPERL_SITE} = "http://perl.apache.org/"; } } use FindBin qw($Bin); use Cwd (); my $verbose_level = exists $opts{v} && $opts{v} =~/^\d+$/ ? $opts{v} : 0; my $cwd = Cwd::fastcwd(); chdir "$Bin/../dst_html/search"; my $swish_binary = $ENV{SWISH_BINARY_PATH} || '/usr/local/bin/swish-e'; die "Cannot find swish-e at $swish_binary: $!" unless -x $swish_binary; $ENV{SPIDER_QUIET} = !$verbose_level; # index my $command = "$swish_binary -v $verbose_level -S prog -c swish.conf"; # Requires updating swish-e. # $command .= ' -E' if $verbose_level || exists $opts{E}; print "Running: [$command]\n" if $verbose_level; CORE::system($command); chdir $cwd;