--- cvs-head/lib/WAIT/InvertedIndex.pm 2000/11/12 17:01:59 36 +++ cvs-head/lib/WAIT/InvertedIndex.pm 2000/11/13 10:44:03 40 @@ -159,19 +159,25 @@ my $dbh = $self->{dbh}; # for convenience my $O = pack('C', 0xff)."o"; - my ($word, $value) = ($O.$;); # $word and $value are modified! - $dbh->seq($word, $value, R_CURSOR) or return $self->{old_index} = 0; + my ($word, $value) = ($O.$;); # $word and $value are modified by seq! + if ( my $ret = $dbh->seq($word, $value, R_CURSOR) ) { + # warn "DEBUG: ret[$ret], not an old index, either empty or no \$^O"; + return $self->{old_index} = 0; + } for (my $i=0; $i<10;$i++) { if ($value !~ /^\d+$/) { + # warn "DEBUG: word[$word]value[$value], not an old index"; return $self->{old_index} = 0; } - if ($dbh->seq($word, $value, R_NEXT) or # no values left + if (my $ret = $dbh->seq($word, $value, R_NEXT) or # no values left $word !~ /^$O$;/o # no $O values left ) { # we are not sure enough that this is an old index + # warn "DEBUG: ret[$ret]word[$word]value[$value], not an old index"; return $self->{old_index} = 0; } } + # warn "DEBUG: old index"; return $self->{old_index} = 1; } @@ -465,7 +471,7 @@ # check which words occur in the index. grep { $self->{db}->{'o'.$_} } @_; - return () unless @terms; # nothing to search for + return unless @terms; # We special-case one term queries here. If the index was sorted, # choping off the rest of the list will return the same ranking.