<& header.mas, head =>"Find1Friend - Social Search Engine" &>

#-------------------------------------------------------------------------------------------# use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); use DBI; use Encode; #-------------------------------------------------------------------------------------------# my $database = "engine3"; my $dbh = DBI->connect("DBI:mysql:mysql_socket=/var/run/mysqld/mysqld.sock;database=$database" ,'root', 'xapian64', { RaiseError => 1, AutoCommit => 0 } ) || die "Database connection not made: $DBI::errstr"; #-------------------------------------------------------------------------------------------# my $sql = qq/ SELECT terms FROM engine3.tag_social ORDER BY id; /; my $sth = $dbh->prepare($sql); $sth->execute(); print "

"; my $term; $sth->bind_col( 1, \$term ); my %hash = (); my $i = 1; my $len = 0; while( $sth->fetch() ) { $len += length($term); last if $len > 1000; if($i < 15) { $hash{$term} = 5; } elsif($i < 30) { $hash{$term} = 4; } elsif($i < 60) { $hash{$term} = 3; } else { $hash{$term} = 2; } $i++; } foreach my $key (sort keys %hash) { my $key2 = decode_utf8($key); #$key2 =~ s/\s+/\+/g; print< $key2, EOF } print "

"; #------------------------------------------------------------------------------# <& footer.mas, mylink =>"find1friend.com" &>