--- db/prgsrc/db.cgi 2004/11/08 02:23:18 1.137 +++ db/prgsrc/db.cgi 2004/11/21 13:37:29 1.138 @@ -13,6 +13,7 @@ use Getopt::Std; #my ($dbuser,$dbname,$dbpass,$dbhost); eval {require "dbdefs.pl";} ; my $url=url||''; +my @used_stop=(); $dbuser||="piataev"; $dbname||="chgk"; $dbpass||=""; @@ -500,19 +501,31 @@ sub russearch { my %relevance; my @blob; my %count; + my %stop_word; POSIX::setlocale( &POSIX::LC_ALL, $thislocale ); $sstr=~tr/йцукенгшщзхъфывапролджэячсмитьбю/ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ/; # @qw=@w =split (' ', uc $sstr); my $ts=uc $sstr; @qw=@w= $ts=~m/(?:(?:${RLrl})+)|(?:[A-Za-z0-9]+)/gom; - + $query="select nf.word from nf where number>=50000"; + $sth=$dbh->prepare($query); + $sth->execute(); + %stop_word=(); + while (@arr = $sth->fetchrow) + { + $stop_word{$arr[0]}=1; + } + $sth->finish; + #----------- foreach $i (0..$#w) # заполняем массив @nf начальных форм # $nf[$i] -- ссылка на массив возможных # начальных форм словоформы $i { + (push @used_stop, uc $w[$i]),next if $stop_word{uc $w[$i]}; $qw= $dbh->quote (uc $w[$i]); + $query=" select distinct w2 from nests where w1=$qw"; $sth=$dbh -> prepare($query); @@ -557,7 +570,7 @@ $sstr=~tr/йцукенгшщзхъфывапролджэячсмить $_= " word2question.word=$_" foreach @arr; $_= " nf.id=".$_. ' ' foreach @arr1; # @arr=(0) unless @arr; - $query="select questions from word2question where (". (join ' OR ', @arr).") AND length(questions)<80000"; + $query="select questions from word2question where (". (join ' OR ', @arr).") "; $sth=$dbh -> prepare($query); $sth->execute; @@ -945,6 +958,8 @@ sub PrintSearch { $Output.= p. "Время поиска: " . (time-$t) ." сек.".p; + $_="\"$_\"" foreach @used_stop; + $Output.= p. (join ', ',@used_stop) ." ignored".p if @used_stop; my ($output, $i, $suffix, $hits) = ('', 0, '', $#Questions + 1); my $shablon;