--- db/prgsrc/db.cgi 2001/05/17 03:57:32 1.19 +++ db/prgsrc/db.cgi 2001/05/18 20:16:33 1.21 @@ -110,6 +110,7 @@ sub Search { my ($dbh, $sstr, $metod) = @_; my (@arr, @Questions, @fields); my (@sar, $i, $sth,$where); + my $btime=time; # push @fields, 'Question'; @@ -159,9 +160,18 @@ sub Search { } else { $sstr = join " OR $f LIKE ", @sar; } - - $sth = $dbh->prepare("SELECT QuestionId FROM Questions - WHERE $f LIKE $sstr ORDER BY QuestionId"); + +### Changed by R7 to prevent showing similar questions######### + + if (param('showequal') eq 'yes') { + $sth = $dbh->prepare("SELECT QuestionId FROM Questions + WHERE $f LIKE $sstr ORDER BY QuestionId"); + } else { + $sth = $dbh->prepare("SELECT QuestionId FROM Questions LEFT JOIN equalto + ON equalto.First=QuestionId WHERE (First IS NULL) AND + ($f LIKE $sstr) ORDER BY QuestionId"); + } + } #else -- processing old-style query (R7) @@ -169,7 +179,7 @@ sub Search { while (@arr = $sth->fetchrow) { push @Questions, $arr[0]; } - + print br, "Search time: ",time-$btime," sec",br if $debug; return @Questions; }