Skip to main content.
home | support | download

Back to List Archive

Re: swish.cgi changes

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Sat Jun 21 2003 - 14:15:39 GMT
On Wed, Jun 18, 2003 at 06:56:41PM -0700, rustin wrote:
> Hi,
> 
> i'm running swish.cgi just fine, but now have a need to support multiple
> users who will be authenticated and have a cookie set. based on their
> cookie, their view of indexes (and document sets) will be restricted.

Nathan gave some good examples.

The swish.cgi script in the new release has an additional feature 
(which is currently undocumented) where you can set a code reference in 
your config file that is called at the start of every request.  That is, 
you can define a Perl subroutine in your config file that can, for 
example, change config settings based on CGI parameters or cookies.

For example, if you wanted to have both an advanced and simple search 
form you might do this in .swishcgi.conf:

    request_fixup => sub {
        my ( $cgi, $conf ) = @_;

        # Optional features
        unless ( $cgi->param('full') ) {
            delete $conf->{date_ranges};
            delete $conf->{select_indexes};
            $conf->{swish_index} = "$prefix/index.swish-e";
        }
     }

So unless there's a CGI parameter of "full" submitted disable the limit 
by date and the index selection options of the script.

So you could also fetch a cookie there and then lookup in a database 
what index to show.

I would recommend against passing the index name in the cookie.  The 
cookie should have a session ID and then use that ID to lookup the 
session on the server side to determine what index to use.  


-- 
Bill Moseley
moseley@hank.org
Received on Sat Jun 21 14:15:40 2003