|
|
Alphabetically Sort Search Engine Results?
|
|
|
|
Grizzled Veteran
Join Date: Oct 2002
Status:
Offline
|
|
I started using a free search engine on my website back in May.
Does anyone know how I can make the search results be sorted alphabetically, either by filename or page title? Either would be fine.
|
BayBook (13" MacBook Pro, 2.4GHz Core 2 Duo, 4GB RAM, 1TB HD) // BayPhone (iPhone 4, 32GB, black)
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Aug 2002
Status:
Offline
|
|
let me prefix this by saying i didn't look to closely, and i haven't done much with perl.
the line's you're interested in are:
Code:
my @keys;
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);
}
in the search.pl script
you probably can just say:
Code:
my @keys;
@keys = keys %answer;
to stop the sorting,
mind you, this is just a guess, i really don't know if that will work.
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Oct 2002
Status:
Offline
|
|
Originally Posted by clam2000
let me prefix this by saying i didn't look to closely, and i haven't done much with perl.
the line's you're interested in are:
Code:
my @keys;
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);
}
in the search.pl script
you probably can just say:
Code:
my @keys;
@keys = keys %answer;
to stop the sorting,
mind you, this is just a guess, i really don't know if that will work.
I figured it was those lines, but unfortunately your suggestion did not work. It seems to sort the same as before.
I know nothing of Perl but I figure this script is being very clever as far as it is concerned, weighting all the results in various ways. I think one route to take would be to strip all that gumph out.
Or, maybe easier, would be to apply an alphabetical sort command to the results, just before they are sent to the page? I realise that this is ass-backwards, doing a whole bunch of work and then undoing it, but if it's easier to implement I don't really mind.
I found this page but as I say, I do not know Perl, nor programming of any kind, so I do not know how to make it go.
|
BayBook (13" MacBook Pro, 2.4GHz Core 2 Duo, 4GB RAM, 1TB HD) // BayPhone (iPhone 4, 32GB, black)
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Oct 2002
Status:
Offline
|
|
Just had me an idea; does anyone know of a javascript that I could put in the template search result page that would sort the results alphabetically?
|
BayBook (13" MacBook Pro, 2.4GHz Core 2 Duo, 4GB RAM, 1TB HD) // BayPhone (iPhone 4, 32GB, black)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|