Skip to main content.
home | support | download

Back to List Archive

RE: Possible to reverse sort on secondary in config

From: Bill Moseley <moseley(at)>
Date: Thu Jun 05 2003 - 20:34:36 GMT
On Thu, Jun 05, 2003 at 11:12:47AM -0700, Jody Cleveland wrote:
> > Can you set a default in whatever front-end program you are using to 
> > search the index?
> Umm. I think I may have misunderstood what you were asking. I've got a
> page:
> I'd like the results of searches on that to be sorted descending by
> rank, and then ascending by size.

So are you using swish.cgi as "search.cgi"?

I assume you don't have "sorts" set up in your config file.  So you can 
do something like change:

    # Set the sort option, if any
    return unless $self->set_sort_order;

    my @sorts = qw/ swishrank desc swishdocsize/;
    $self->swish_command( '-s', @sorts );

Or another opiton, if you are using 2.4.0, you might be able to do 
something like this in .swishcgi.conf (untested)

return {
    sorts => ['swishrank'],
    secondary_sort => [qw/swishdocsize/],

    request_fixup => sub {
        my ( $cgi, $conf ) = @_;
        # Force a CGI input value "sort" to be swishrank
        $cgi->param('sort', 'swishrank' );

That make any sense?

Bill Moseley
Received on Thu Jun 5 20:34:45 2003