version 1.37, 2001/11/26 10:31:49
|
version 1.39, 2001/12/03 02:28:56
|
Line 7 use strict;
|
Line 7 use strict;
|
use Time::Local; |
use Time::Local; |
use POSIX qw(locale_h); |
use POSIX qw(locale_h); |
use locale; |
use locale; |
#open STDERR, ">errors"; |
#open STDERR, ">errors1"; |
my $printqueries=0; |
my $printqueries=0; |
my %forbidden=(); |
my %forbidden=(); |
my $debug=0; #added by R7 |
my $debug=0; #added by R7 |
Line 21 my $thislocale;
|
Line 21 my $thislocale;
|
|
|
$searchin{'question'}=param('Question'); |
$searchin{'question'}=param('Question'); |
$searchin{'answer'}=param('Answer'); |
$searchin{'answer'}=param('Answer'); |
$searchin{'comment'}=param('Comment'); |
$searchin{'comments'}=param('Comments'); |
$searchin{'authors'}=param('Authors'); |
$searchin{'authors'}=param('Authors'); |
$searchin{'sources'}=param('Sources'); |
$searchin{'sources'}=param('Sources'); |
my $all=param('all'); |
my $all=param('all'); |
Line 161 print "$query",br if $printqueries;
|
Line 161 print "$query",br if $printqueries;
|
} |
} |
|
|
|
|
my @bad=grep {!$nf[$_]} 0..$#w; # @bad -- номера словоформ, |
my @bad=grep {!@{$nf[$_]}} 0..$#w; # @bad -- номера словоформ, |
# которых нет в словаре |
# которых нет в словаре |
|
|
if (@bad) #есть неопознанные словоформы |
if (@bad) #есть неопознанные словоформы |
Line 192 print "$query",br if $printqueries;
|
Line 192 print "$query",br if $printqueries;
|
|
|
$_= " word2question.word=".$_. ' ' foreach @arr; |
$_= " word2question.word=".$_. ' ' foreach @arr; |
$_= " nf.id=".$_. ' ' foreach @arr1; |
$_= " nf.id=".$_. ' ' foreach @arr1; |
|
# @arr=(0) unless @arr; |
$query="select questions from word2question where". (join ' OR ', @arr); |
$query="select questions from word2question where". (join ' OR ', @arr); |
print "$query\n",br if $printqueries; |
print STDERR "!$query\n",br if $printqueries; |
|
|
$sth=$dbh -> prepare($query); |
$sth=$dbh -> prepare($query); |
$sth->execute; |
$sth->execute; |
Line 332 if $$words{$first};
|
Line 332 if $$words{$first};
|
sub Search { |
sub Search { |
my ($dbh, $sstr,$metod,$all,$allnf) = @_; |
my ($dbh, $sstr,$metod,$all,$allnf) = @_; |
my (@arr, @Questions, @fields); |
my (@arr, @Questions, @fields); |
my (@sar, $i, $sth,$where); |
my (@sar, $i, $sth,$where,$query); |
|
my $ip=$ENV{'REMOTE_ADDR'}; |
|
|
# push @fields, 'Question'; |
$ip=$dbh->quote($ip); |
|
$query= |
|
"INSERT into queries (query,metod,searchin,ip) |
|
values (". $dbh->quote($sstr).', '. |
|
$dbh->quote($metod) . ', ' . |
|
$dbh->quote(join ' ', grep $searchin{$_}, keys %searchin) . |
|
", $ip)"; |
|
print $query if $printqueries; |
|
$dbh -> do ($query); |
|
|
if ($metod eq 'rus') |
if ($metod eq 'rus') |
{ |
{ |
Line 362 sub Search {
|
Line 371 sub Search {
|
-fields_searched => $fields); |
-fields_searched => $fields); |
|
|
$where= $$q{'matchexp'}; |
$where= $$q{'matchexp'}; |
my $query= "SELECT Questionid FROM Questions |
$query= "SELECT Questionid FROM Questions |
WHERE $where"; |
WHERE $where"; |
print br."Query is: $query".br if $debug; |
print br."Query is: $query".br if $debug; |
|
|