Skip to main content.
home | support | download

Back to List Archive

Re: swish.cgi config question

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Thu Dec 19 2002 - 20:40:39 GMT
At 01:59 PM 12/19/02 -0500, Peggy Eaton wrote:
>my $buffer = $ENV{'QUERY_STRING'};
>
># Split the Name value pairs
>my %pairs = split (/[&=]/, $buffer);
>my $name="";
>my $value="";
>my %FORM;
>foreach (%pairs)
>{
>      tr/+/ /;
>      s/%(..)/pack("C",hex($1))/eg;
>}
>
>while(($name, $value) = each %pairs){
>	next if ($name eq 'search_tags');
>	push(my @search_tags, $value);
>	$FORM{$name} = $value;
>}

Is this easier?  (not tested)

my %configs = (
     1 => 'one.config',
     2 => 'two.config',
);

my $config_number = ($ENV{QUERY_STRING} || '') =~ /config=(\d+)/
   ? 1;
   : 0;  # default to zero

my $DEFAULT_CONFIG_FILE = $configs{$config_number} || 'default.config';

>I've verified that the $DEFAULT_CONFIG_FILE value is passed in 
>correctly, but once a text string is entered for searching, the 
>swish.cgi default configuration parameters are used.

That's because you need to add the config parameter to every URL generated
by the program.  You might be able to just modify these:

    $self->{query_href} = $q->script_name . '?' . join '&amp;', @query_string;
    $self->{my_url} = $q->script_name;

but you would also want to check the templates, too.  Solve one problem at
a time kind of thing.

>> If you use mod_perl you will have some very fast searches.  
>
>I'm checking again with our sys admins to see if this is available for 
>us now.  The last time I checked, they didn't want it used because of 
>security problems.

If you are on an ISP they probably won't want you to use mod_perl because
it gives you too much power over the server.  One option is to either run
your searches on a high port and run a separate server (would only need two
or three MaxClients) or better reverse proxy from your static server to the
mod_perl server so you don't use weird port numbers.


-- 
Bill Moseley
mailto:moseley@hank.org
Received on Thu Dec 19 20:40:48 2002