159 |
my $dbh = $self->{dbh}; # for convenience |
my $dbh = $self->{dbh}; # for convenience |
160 |
|
|
161 |
my $O = pack('C', 0xff)."o"; |
my $O = pack('C', 0xff)."o"; |
162 |
my ($word, $value) = ($O.$;); # $word and $value are modified! |
my ($word, $value) = ($O.$;); # $word and $value are modified by seq! |
163 |
$dbh->seq($word, $value, R_CURSOR) or return $self->{old_index} = 0; |
if ( my $ret = $dbh->seq($word, $value, R_CURSOR) ) { |
164 |
|
# warn "DEBUG: ret[$ret], not an old index, either empty or no \$^O"; |
165 |
|
return $self->{old_index} = 0; |
166 |
|
} |
167 |
for (my $i=0; $i<10;$i++) { |
for (my $i=0; $i<10;$i++) { |
168 |
if ($value !~ /^\d+$/) { |
if ($value !~ /^\d+$/) { |
169 |
|
# warn "DEBUG: word[$word]value[$value], not an old index"; |
170 |
return $self->{old_index} = 0; |
return $self->{old_index} = 0; |
171 |
} |
} |
172 |
if ($dbh->seq($word, $value, R_NEXT) or # no values left |
if (my $ret = $dbh->seq($word, $value, R_NEXT) or # no values left |
173 |
$word !~ /^$O$;/o # no $O values left |
$word !~ /^$O$;/o # no $O values left |
174 |
) { |
) { |
175 |
# we are not sure enough that this is an old index |
# we are not sure enough that this is an old index |
176 |
|
# warn "DEBUG: ret[$ret]word[$word]value[$value], not an old index"; |
177 |
return $self->{old_index} = 0; |
return $self->{old_index} = 0; |
178 |
} |
} |
179 |
} |
} |
180 |
|
# warn "DEBUG: old index"; |
181 |
return $self->{old_index} = 1; |
return $self->{old_index} = 1; |
182 |
} |
} |
183 |
|
|
471 |
# check which words occur in the index. |
# check which words occur in the index. |
472 |
grep { $self->{db}->{'o'.$_} } @_; |
grep { $self->{db}->{'o'.$_} } @_; |
473 |
|
|
474 |
return () unless @terms; # nothing to search for |
return unless @terms; |
475 |
|
|
476 |
# We special-case one term queries here. If the index was sorted, |
# We special-case one term queries here. If the index was sorted, |
477 |
# choping off the rest of the list will return the same ranking. |
# choping off the rest of the list will return the same ranking. |