Perlfect Solutions
 

[Perlfect-search] Can Search Results Be Sorted by File Name?

Marc Borbely perlfect-search@perlfect.com
Mon, 28 Jul 2003 11:14:52 -0400
Thank you so much.

I first tried sorting by title (with <input type="hidden" name="sort"
value="title">, as you suggested), but then realized that even though I have
the dates in the titles, I have them spelled out, and therefore the April
titles pop up first -- so that didn't help.

Next, I deleted and added the lines as you suggested (and switched $a and
$b, since it's even better if I can get them in reverse chronological
order), and it works perfectly.

Again, thanks for your help.

- Marc Borbely

----- Original Message -----
From: "Daniel Naber" <daniel.naber@t-online.de>
To: <perlfect-search@perlfect.com>; "Marc Borbely" <borbely@howitis.org>
Sent: Monday, July 28, 2003 10:25 AM
Subject: Re: [Perlfect-search] Can Search Results Be Sorted by File Name?


> On Monday 28 July 2003 15:49, Marc Borbely wrote:
>
> > I'm wondering if there's any way to sort the results of searches by
> > filename, instead of by the regular ranking system.
>
> If you make a small change to the search.pl script, yes. Around line 447,
you need
> to insert this line:
>
>   @keys = sort {uc($docs_db{$a}) cmp uc($docs_db{$b})} (keys %answer);
>
> and remove these lines:
>
>    if( defined($query->param('sort')) && $query->param('sort') eq
'title' ) {
>     @keys = sort {uc($titles_db{$a}) cmp uc($titles_db{$b})} (keys
%answer);
>   } else {
>     @keys = sort {$answer{$b} <=> $answer{$a}} (keys %answer);
>   }
>
> Alternatively you could sort by title (your titles then need issue
numbers, but
> that might be a good idea anyway). Just set a hidden field:
> <input type="hidden" name="sort" value="title">
>
> Regards
>  Daniel
>
> --
> http://www.danielnaber.de
> _______________________________________________
> perlfect-search mailing list
> perlfect-search@perlfect.com
> To unsubscribe, set other personal options or view the list archives
please visit:
> 
> 
>