stas        02/03/22 02:42:04

  Modified:    src/search README swish.cgi
  Added:       src/search apache.org-setup.pl
  Log:
  adding a special file loading the right environment for the search on
  the production site
  
  Revision  Changes    Path
  1.5       +16 -3     modperl-docs/src/search/README
  
  Index: README
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/search/README,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- README    22 Mar 2002 06:40:23 -0000      1.4
  +++ README    22 Mar 2002 10:42:04 -0000      1.5
  @@ -40,8 +40,9 @@
   
      setenv MODPERL_SITE http://perl.apache.org
   
  -This is used as the base for spidering, plus is used to determine
  -the sections of the site (for limiting the site to those sections.
  +This is used as the base for spidering, plus is used to determine the
  +sections of the site (for limiting the site to those sections, see
  +below)
       
   =item 2 
   
  @@ -134,7 +135,18 @@
   the site is created. 
   
   The main search page I</search/swish.cgi>, has multiply checkboxes for
  -the for the C<sbm> variable searching only certain parts of the site.
  +the for the C<sbm> variable so you can limit searches to only selected
  +sections.
  +
  +The C<$ENV{MODPERL_SITE}> mentioned earlier is matched against the
  +C<sbm> variable to extract only the wanted subsets of the hits:
  +
  +  $uri =~ m!$ENV{MODPERL_SITE}{/([^/]+)/.+$!
  +
  +where C<$1> is used as the section name.  So it's just using the
  +initial directory name for the section.
  +
  +
   
   =back
   
  @@ -166,3 +178,4 @@
   Another trick, you can send SIGHUP to I<spider.pl> while indexing and
   it will stop spidering, but let swish index what's been read so far.
   
  +=cut
  \ No newline at end of file
  
  
  
  1.4       +11 -7     modperl-docs/src/search/swish.cgi
  
  Index: swish.cgi
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/search/swish.cgi,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- swish.cgi 3 Mar 2002 11:27:22 -0000       1.3
  +++ swish.cgi 22 Mar 2002 10:42:04 -0000      1.4
  @@ -2,6 +2,9 @@
   package SwishSearch;
   use strict;
   
  +# optional file
  +eval {require "./apache.org-setup.pl"};
  +
   use lib qw( modules );  ### This may need to be adjusted!
                           ### It should point to the location of the
                           ### associated script modules directory
  @@ -15,7 +18,7 @@
   #
   #    To display documentation for this program type "perldoc swish.cgi"
   #
  -#    swish.cgi $Revision: 1.3 $ Copyright (C) 2001 Bill Moseley [EMAIL 
PROTECTED]
  +#    swish.cgi $Revision: 1.4 $ Copyright (C) 2001 Bill Moseley [EMAIL 
PROTECTED]
   #    Example CGI program for searching with SWISH-E
   #
   #    This example program will only run under an OS that supports fork().
  @@ -34,7 +37,7 @@
   #
   #    The above lines must remain at the top of this program
   #
  -#    $Id: swish.cgi,v 1.3 2002/03/03 11:27:22 stas Exp $
  +#    $Id: swish.cgi,v 1.4 2002/03/22 10:42:04 stas Exp $
   #
   
####################################################################################
   
  @@ -103,7 +106,6 @@
   
   sub default_config {
   
  -
       
       ##### Configuration Parameters #########
   
  @@ -130,10 +132,12 @@
       #
       #   Again, this is a Perl hash structure.  Commas are important.
       #======================================================================
  -    
  +
  +    my $swish_binary = $ENV{SWISH_BINARY_PATH} || './swish-e';
  +    die "Cannot find swish-e at $swish_binary: $!" unless -x $swish_binary;
       return {
  -        title           => 'Search our site',  # Title of your choice.  
Displays on the search page
  -        swish_binary    => './swish-e',        # Location of swish-e binary
  +        title           => 'Search perl.apache.org site',  # Title of your 
choice.  Displays on the search page
  +        swish_binary    => $swish_binary,        # Location of swish-e binary
   
   
           # By default, this script tries to read a config file.  You should 
probably
  @@ -2512,7 +2516,7 @@
   
   =head1 LICENSE
   
  -swish.cgi $Revision: 1.3 $ Copyright (C) 2001 Bill Moseley [EMAIL PROTECTED]
  +swish.cgi $Revision: 1.4 $ Copyright (C) 2001 Bill Moseley [EMAIL PROTECTED]
   Example CGI program for searching with SWISH-E
   
   
  
  
  
  1.1                  modperl-docs/src/search/apache.org-setup.pl
  
  Index: apache.org-setup.pl
  ===================================================================
  require Sys::Hostname;
  my $hostname = Sys::Hostname::hostname();
  
  # to use the setup at home, simply add to httpd.conf:
  # SetEnv SWISH_BINARY_PATH /usr/local/bin/swish-e
  # adjust to the real path
  
  # on daedalus (the production server) we cannot modify the config file
  # so we do it here
  if ($hostname && $hostname eq 'daedalus.apache.org') {
      $ENV{SWISH_BINARY_PATH} = "/usr/local/bin/swish-e";
  }
  
  
  1;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to