Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Re: search results line up???

Quote Reply
Re: search results line up??? In reply to
This maybe is my last help because I need to finish my project in hurry within one week.
In db_utils.pl try change the following:

From:
sub build_sorthit {
# --------------------------------------------------------
# This function sorts a list of links. It has been modified to sort
# new links first, then cool links, then the rest alphabetically. By modifying
# the sort function below, you can sort the links however you like (by date,
# or random, etc.).
#
my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
my (%sortby, %isnew, %iscool, $hit, $i, @sorted);
for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") and ($isnew{$i} = 1);
($unsorted[$db_ispop + ($i * ($#db_cols+1))] eq "Yes") and ($iscool{$i} = 1);
}
foreach $hit (sort {
($isnew{$b} and !$isnew{$a}) and return 1;
($isnew{$a} and !$isnew{$b}) and return -1;
($iscool{$b} and !$iscool{$a}) and return 1;
($iscool{$a} and !$iscool{$b}) and return -1;
($isnew{$a} and $isnew{$b}) and return $sortby{$b} <=> $sortby{$a};
($iscool{$a} and $iscool{$b}) and return $sortby{$b} <=> $sortby{$a};
$sortby{$b} <=> $sortby{$a};
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
return @sorted;
}

To:
sub build_sorthit {
# --------------------------------------------------------
# This function sorts a list of links. It has been modified to sort
# new links first, then cool links, then the rest alphabetically. By modifying
# the sort function below, you can sort the links however you like (by date,
# or random, etc.).
#
my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
my (%sortby, $hit, $i, %isnew, %iscool, @sorted);
for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") and ($isnew{$i} = 1);
($unsorted[$db_ispop + ($i * ($#db_cols+1))] eq "Yes") and ($iscool{$i} = 1);
}
foreach $hit (sort {
($isnew{$b} and !$isnew{$a}) and return 1;
($isnew{$a} and !$isnew{$b}) and return -1;
($iscool{$b} and !$iscool{$a}) and return 1;
($iscool{$a} and !$iscool{$b}) and return -1;
($isnew{$a} and $isnew{$b}) and return $sortby{$b} <=> $sortby{$a};
($iscool{$a} and $iscool{$b}) and return $sortby{$b} <=> $sortby{$a};
$sortby{$b} <=> $sortby{$a};
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
return @sorted;
}

Regards,

Nuno Duque
--------------------
Macau Search Engine
inmacau.com
Subject Author Views Date
Thread changing auto-email subject line???? gossy 11640 Oct 14, 2000, 11:53 PM
Thread Re: changing auto-email subject line????
nduque 11206 Oct 15, 2000, 2:37 AM
Thread Re: changing auto-email subject line????
gossy 11178 Oct 15, 2000, 4:33 PM
Thread Re: changing auto-email subject line????
nduque 11264 Oct 15, 2000, 5:57 PM
Thread Re: changing auto-email subject line????
gossy 11166 Oct 15, 2000, 10:37 PM
Post Re: changing auto-email subject line????
nduque 11082 Oct 16, 2000, 12:58 AM
Thread Re: oh and i forgot,???
gossy 11102 Oct 15, 2000, 10:39 PM
Post Re: oh and i forgot,???
nduque 11081 Oct 16, 2000, 1:10 AM
Thread Re: changing auto-email subject line????
gossy 11098 Oct 15, 2000, 11:17 PM
Thread Re: changing auto-email subject line????
nduque 11147 Oct 16, 2000, 1:15 AM
Thread Re: very good info again, thanks
gossy 11095 Oct 16, 2000, 4:36 PM
Thread Re: very good info again, thanks
nduque 11076 Oct 17, 2000, 12:32 AM
Thread Re: very good info again, thanks
gossy 11182 Oct 17, 2000, 2:30 AM
Thread Re: very good info again, thanks
nduque 11155 Oct 17, 2000, 3:13 AM
Thread Re: very good info again, thanks
gossy 11077 Oct 17, 2000, 8:30 PM
Thread Re: very good info again, thanks
nduque 11135 Oct 17, 2000, 11:00 PM
Thread got your site and one more question
gossy 11083 Oct 18, 2000, 2:08 AM
Thread Re: got your site and one more question
nduque 11095 Oct 18, 2000, 3:14 AM
Thread yep, works, thanks once more.
gossy 11069 Oct 18, 2000, 3:20 PM
Thread Re: yep, works, thanks once more.
nduque 11137 Oct 18, 2000, 11:39 PM
Thread Re: misunderstanding
gossy 5631 Oct 19, 2000, 1:31 AM
Post Re: misunderstanding
nduque 5526 Oct 19, 2000, 4:56 AM
Thread Re: search result display
gossy 5546 Oct 19, 2000, 2:00 AM
Post Re: search result display
nduque 5552 Oct 19, 2000, 5:13 AM
Thread search results line up???
gossy 11098 Oct 18, 2000, 3:25 PM
Thread Re: search results line up???
nduque 11120 Oct 18, 2000, 11:47 PM
Thread Re: search results line up???
gossy 5622 Oct 19, 2000, 1:24 AM
Thread Re: search results line up???
nduque 5554 Oct 19, 2000, 4:25 AM
Post last question
gossy 5520 Oct 19, 2000, 2:26 PM
Thread yes, there is already that question!
gossy 11174 Oct 17, 2000, 10:54 PM
Post Re: yes, there is already that question!
nduque 11047 Oct 18, 2000, 12:34 AM
Thread @search_fields = (1,2,5,6,7); =no change
gossy 11114 Oct 18, 2000, 5:10 PM
Thread Re: @search_fields = (1,2,5,6,7); =no change
nduque 5694 Oct 18, 2000, 11:55 PM
Thread Re: @search_fields = (1,2,5,6,7); =no change
gossy 5652 Oct 19, 2000, 1:44 AM
Post Re: @search_fields = (1,2,5,6,7); =no change
nduque 5557 Oct 19, 2000, 5:00 AM
Thread Re: yes, it';s the dam <p>'s
gossy 5551 Oct 19, 2000, 2:30 AM
Post Re: yes, it';s the dam <p>'s
nduque 5557 Oct 19, 2000, 5:21 AM
Thread found something..
gossy 5510 Oct 19, 2000, 2:51 AM
Post Re: found something..
nduque 5544 Oct 19, 2000, 5:23 AM