my ($results, $kw, $nres, $reverses) = @_;
my ($key, $value) = ($kw, "");
my ($results, $kw, $nres, $reverses) = @_;
my ($key, $value) = ($kw, "");
for (my $status = $reverses->seq($key, $value, R_CURSOR);
$status == 0;
$status = $reverses->seq( $key, $value, R_NEXT)) {
for (my $status = $reverses->seq($key, $value, R_CURSOR);
$status == 0;
$status = $reverses->seq( $key, $value, R_NEXT)) {
# FIXME: what's the most efficient "is prefix of" thingy? We only want to know
# whether $kw is or is not a prefix of $key
last unless index($key, $kw) == 0;
# FIXME: what's the most efficient "is prefix of" thingy? We only want to know
# whether $kw is or is not a prefix of $key
last unless index($key, $kw) == 0;
my @hits = split /\0/o, $value;
push @$results, [ scalar reverse($key), @hits ];
my @hits = split /\0/o, $value;
push @$results, [ scalar reverse($key), @hits ];