Search::Odeum - Perl interface to the Odeum inverted index API.
Create inverted index and put your document.
use Search::Odeum; my $od = Search::Odeum->new('index', OD_OWRITER|OD_OCREAT); my $doc = Search::Odeum::Document->new('http://www.example.com/'); $doc->attr('title' => 'example.com'); # ... break text into words. $doc->addword($normal, $asis); $od->put($doc); $od->close;
Search the inverted index to retrieve documents.
use Search::Odeum; my $od = Search::Odeum->new('index', OD_OREADER); my $res = $od->search($word); # $res is-a Search::Odeum::Result while(my $doc = $res->next) { printf "%s\n", $doc->uri; } $od->close;
Search::Odeum is an interface to the Odeum API. Odeum is the inverted index API which is a part of qdbm database library.
Create new Search::Odeum instance. $name specifies the databse directory. $omode specifies the open mode.
store a document into the database. $doc is a Search::Odeum::Document object. $wmax specifies the max number of words to be stored. the default is unlimited. $over specifies the duplicated document will be overwritten or not. the default behavior is true.
delete a document from database. $uri specifies the document URI string.
delete a document from database. $id specifies the document ID
retrieve a document from database. $uri specifies the document URI string.
retrieve a document from database. $id specifies the document ID
retrieve a document ID by the document URI. $uri specifies the document URI string.
check whether the specified document exists. $id specifies the document ID
search inverted index. $word specifies the searching word. $max specifies the max number of documents to be retrieved. return value is a Search::Odeum::Result object.
get the number of documents including a word. this method is faster than search. $word specifies the searching word.
query a database using a small boolean query language.
synchronize updated contents to the device.
optimize a database.
get the name of database.
get the total size of database files.
get the total number of the elements of the bucket arrays in the inverted index
get the total number of the used elements of the bucket arrays in the inverted index
get the number of documents in database.
get the number of words in database.
check whether a database is writable or not.
check whether a database has a fatal error or not.
get the inode number of a database directory.
get the last modified time of a database.
close a database handle.
http://qdbm.sourceforge.net/
Tomohiro IKEBE, <ikebe@shebang.jp>
Copyright (C) 2007 by Tomohiro IKEBE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install Search::Odeum, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::Odeum
CPAN shell
perl -MCPAN -e shell install Search::Odeum
For more information on module installation, please visit the detailed CPAN module installation guide.