Skip to main content.
home | support | download

Back to List Archive

Re: (patch) select_indexes and brief don't mix

From: <moseley(at)not-real.hank.org>
Date: Wed Jul 30 2003 - 15:15:10 GMT
On Wed, Jul 30, 2003 at 07:28:41AM -0700, Dan Debertin wrote:
> In swish.cgi, if swish_index is an arrayref and the brief search is
> used, there's no opportunity to select the index and swish-e tries to
> use the system default. This patch adds a 'default_index' parameter to
> select_indexes, which is used if no index is selected.

Thanks Dan,

I applied the patch.


> 
> --- /usr/local/lib/swish-e/swish.cgi    2003-07-28 11:54:00.610019000 -0500
> +++ swish.cgi   2003-07-30 09:01:57.950004000 -0500
> @@ -390,6 +390,7 @@
>              # labels must match up one-to-one with elements in "swish_index"
>              labels  => [ 'Main Index', 'Other Index', qw/ two three four/ ],  
>              description => 'Select Site: ',
> +                       default_index => '',  
>          },
>  
>  
> @@ -1362,12 +1385,19 @@
>      
>      # Set the index file - first check for options
>      
> -    if ( $self->config('select_indexes') && ref $self->config('swish_index') eq 'ARRAY'  ) {
> +       my $si = $self->config('select_indexes');
> +    if ( $si && ref $self->config('swish_index') eq 'ARRAY'  ) {
>  
>          my @choices = $q->param('si');
>          if ( !@choices ) {
> -            $self->errstr('Please select a source to search');
> -            return;
> +                       if ( $si->{'default_index'} ) {
> +                               $self->swish_command('-f', $si->{'default_index'});
> +                               return 1;
> +                       }
> +                       else {
> +               $self->errstr('Please select a source to search');
> +               return;
> +                       }
>          }
>  
>          my @indexes = @{$self->config('swish_index')};
> 
> Dan
> -- 
> Dan Debertin                             Unix Systems Admin
> Diehl Hall #203B			 University of Minnesota
> (612)626-6468				 Bio-Medical Library
> debertin@umn.edu
> 

-- 
Bill Moseley
moseley@hank.org
Received on Wed Jul 30 15:16:57 2003