Search::Odeum - Perl interface to the Odeum inverted index API.


Search-Odeum documentation Contained in the Search-Odeum distribution.

Index


Code Index:

NAME

Top

Search::Odeum - Perl interface to the Odeum inverted index API.

SYNOPSIS

Top

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;

DESCRIPTION

Top

Search::Odeum is an interface to the Odeum API. Odeum is the inverted index API which is a part of qdbm database library.

METHODS

Top

Search::Odeum->new($name, $omode)

Create new Search::Odeum instance. $name specifies the databse directory. $omode specifies the open mode.

put($doc, $wmax, $over)

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.

out($uri)

delete a document from database. $uri specifies the document URI string.

outbyid($id)

delete a document from database. $id specifies the document ID

get($uri)

retrieve a document from database. $uri specifies the document URI string.

getbyid($id)

retrieve a document from database. $id specifies the document ID

getidbyuri($uri)

retrieve a document ID by the document URI. $uri specifies the document URI string.

check($id)

check whether the specified document exists. $id specifies the document ID

search($word, $max)

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.

searchdnum($word)

get the number of documents including a word. this method is faster than search. $word specifies the searching word.

query($query)

query a database using a small boolean query language.

sync

synchronize updated contents to the device.

optimize

optimize a database.

name

get the name of database.

fsiz

get the total size of database files.

bnum

get the total number of the elements of the bucket arrays in the inverted index

busenum

get the total number of the used elements of the bucket arrays in the inverted index

dnum

get the number of documents in database.

wnum

get the number of words in database.

writable

check whether a database is writable or not.

fatalerror

check whether a database has a fatal error or not.

inode

get the inode number of a database directory.

mtime

get the last modified time of a database.

close

close a database handle.

SEE ALSO

Top

http://qdbm.sourceforge.net/

AUTHOR

Top

Tomohiro IKEBE, <ikebe@shebang.jp>

COPYRIGHT AND LICENSE

Top


Search-Odeum documentation Contained in the Search-Odeum distribution.

package Search::Odeum;
use strict;
use warnings;
use base qw(Exporter);

use constant OD_OREADER => 1 << 0;
use constant OD_OWRITER => 1 << 1;
use constant OD_OCREAT => 1 << 2;
use constant OD_OTRUNC => 1 << 3;
use constant OD_ONOLCK => 1 << 4;
use constant OD_OLOCKNB => 1 << 5;

our @EXPORT = qw(OD_OREADER OD_OWRITER OD_OCREAT OD_OTRUNC OD_ONOLCK OD_OLOCKNB
);
our $VERSION;

BEGIN
{
    $VERSION = '0.02';
    if ($] > 5.006) {
        require XSLoader;
        XSLoader::load(__PACKAGE__, $VERSION);
    } else {
        require DynaLoader;
        @Senna::ISA = ('DynaLoader');
        __PACKAGE__->bootstrap();
    }
}

sub new {
    my($class, $name, $omode) = @_;
    $omode ||= OD_OREADER;
    $class->xs_new($name, $omode);
}

use Search::Odeum::Document;

# Preloaded methods go here.

1;
__END__
# Below is stub documentation for your module. You'd better edit it!