Search::InvertedIndex is a manager for inverted index maps.
SYNOPSIS
use Search::InvertedIndex;
my $database = Search::InvertedIndex::DB::DB_File_SplitHash->new({
-map_name => '/www/search-engine/databases/test-maps/test',
-multi => 4,
-file_mode => 0644,
-lock_mode => 'EX',
-lock_timeout => 30,
-blocking_locks => 0,
-cachesize => 1000000,
-write_through => 0,
-read_write_mode => 'RDWR';
});
my $inv_map = Search::Inverted->new({ -database => $database });
##########################################################
# Example Update
##########################################################
my $index_data = "Some scalar - complex structure refs are ok";
my $update = Search::InvertedIndex::Update->new({
-group => 'keywords',
-index => 'http://www.nihongo.org/',
-data => $index_data,
-keys => {
'some' => 10,
'scalar' => 20,
'complex' => 15,
'structure' => 15,
'refs' => 15,
'are' => 15,
'ok' => 15,
},
});
my $result = $inv_map->update({ -update => $update });
##########################################################
# Example Query
# '-nodes' is an anon list of Search::InvertedIndex::Query
# objects (this allows constructing complex booleans by
# nesting).
#
# '-leafs' is an anon list of Search::InvertedIndex::Query::Leaf
# objects (used for individual search terms).
#
##########################################################
my $query_leaf1 = Search::InvertedIndex::Query::Leaf->new({
-key => 'complex',
-group => 'keywords',
-weight => 1,
});
my $query_leaf2 = Search::InvertedIndex::Query::Leaf->new({
-key => 'structure',
-group => 'keywords',
-weight => 1,
});
my $query_leaf3 = Search::InvertedIndex::Query::Leaf->new({
-key => 'gold',
-group => 'keywords',
-weight => 1,
});
my $query1 = Search::InvertedIndex::Query->new({
-logic => 'and',
-weight => 1,
-nodes => [],
-leafs => [$query_leaf1,$query_leaf2],
});
my $query2 = Search::InvertedIndex::Query->new({
-logic => 'or',
-weight => 1,
-nodes => [$query1],
-leafs => [$query_leaf3],
});
my $result = $inv_map->search({ -query => $query2 });
##########################################################
$inv_map->close;
Product's homepage
Requirements:
· Perl