NAME
Senna::Index - Senna Index Object
SYNOPSIS
use Senna;
my $index = Senna::Index->create();
my $index = Senna::Index->open($path);
$index->insert($key, $value);
$index->select($query);
METHODS
create
Creates a new index.
my $index = Senna::Index->create(
$path, $key_size, $flags, $initial_n_segments, $encoding
);
my $index = Senna::Index->create({
path => $path,
key_size => $key_size,
flags => $flags,
initial_n_segments => $initial_n_segments,
encoding => $encoding
});
For backwards compatibility, if given anything other than 1 or 5 arguments, create() assumes that you've been given a key value pair like so:
my $index = Senna::Index->create(
path => $path,
key_size => $key_size,
flags => $flags,
initial_n_segments => $initial_n_segments,
encoding => $encoding
);
However, note that this form is DEPRECATED. Use the HASHREF form instead
open
Opens an existing index.
my $index = Senna::Index->open($path);
my $index = Senna::Index->open({ path => $path });
For backwards compatibility, if given more than one argument, open() assumes that you've been given a key value pair like so:
my $index = Senna::Index->open(path => $path);
However, note that this form is DEPRECATED. Use the HASHREF form instead
info
In scalar context, returns a Senna::Index::Info object.
$info = $index->info;
$info->key_size();
In list context, returns the same informtion as a list:
($key_size, $flags, $initial_n_segments, $encoding, $nrecords_keys,
$file_size_keys, $nrecords_lexicon, $file_size_lexicon, $inv_seg_size,
$inv_chunk_size) = $index->info
path
Returns the path to the senna index.
close
remove
update
insert
Inserts a new entry in the index.
$index->insert($key, $value);
$index->insert({ key => $key, value => $value });
For backwards compatibility if given more than 2 arguments, insert() assumes that you've been given a key/value pair like so:
$index->insert(key => $key, value => $value);
However, note that this form is DEPRECATED. Use the HASHREF form instead
select
Performs a select on the given index.
$index->select( $query );
$index->select({ query => $query });