The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

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

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

METHODS

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

http://qdbm.sourceforge.net/

AUTHOR

Tomohiro IKEBE, <ikebe@shebang.jp>

COPYRIGHT AND LICENSE

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.