--- lib/Search/TokyoDystopia.pm 2008/09/21 14:24:22 36 +++ lib/Search/TokyoDystopia.pm 2008/09/21 20:16:39 37 @@ -94,6 +94,48 @@ tcqdbtnum tcqdbfsiz +tcjdberrmsg +tcjdbnew +tcjdbdel +tcjdbnew +tcjdbecode +tcjdbtune +JDBTLARGE +JDBTDEFLATE +JDBTTCBS +tcjdbsetcache +tcjdbsetfwmmax +tcjdbopen +JDBOREADER +JDBOWRITER +JDBOCREAT +JDBOTRUNC +JDBONOLCK +JDBOLCKNB +tcjdbclose +tcjdbput +tcjdbput2 +tcjdbout +tcjdbget +tcjdbget2 +tcjdbsearch +tcjdbsearch2 +JDBSSUBSTR +JDBSPREFIX +JDBSSUFFIX +JDBSFULL +JDBSTOKEN +JDBSTOKPRE +JDBSTOKSUF +tcjdbiterinit +tcjdbiternext +tcjdbsync +tcjdboptimize +tcjdbvanish +tcjdbcopy +tcjdbpath +tcjdbtnum +tcjdbfsiz ); =head1 NAME @@ -155,7 +197,7 @@ =head2 tcidbsetfwmmax - my $success = tcidbsetfwmmax( $idb, $fwnum ); + my $success = tcidbsetfwmmax( $idb, $fwmax ); =head2 tcidbopen @@ -246,6 +288,7 @@ =cut + =head1 Q-gram API =head2 tcqdberrmsg @@ -282,7 +325,7 @@ =head2 tcqdbsetfwmmax - my $success = tcqdbsetfwmmax( $qdb, $fwnum ); + my $success = tcqdbsetfwmmax( $qdb, $fwmax ); =head2 tcqdbopen @@ -355,6 +398,120 @@ my $file_size = tcqdbtsiz( $qdb ); + +=head1 Simple API + +=head2 tcjdberrmsg + + my $message = tcjdberrmsg( $ecode ); + +=head2 tcjdbnew + + my $jdb = tcjdbnew; + +=head2 tcjdbdel + + tcjdbdel( $jdb ); + +=head2 tcjdbecode + + my $ecode = tcjdbecode( $jdb ); + +=head2 tcjdbtune + + my $success = tcjdbtune( $jdb, $ernum, $etnum, $iusiz, JDBTLARGE | JDBTDEFLATE ); + +=cut + +use constant { + JDBTLARGE => 1 << 0, + JDBTDEFLATE => 1 << 1, + JDBTTCBS => 1 << 2, +}; + +=head2 tcjdbsetcache + + my $success = tcjdbsetcache( $jdb, $icsiz, $lcnum ); + +=head2 tcjdbsetfwmmax + + my $success = tcjdbsetfwmmax( $jdb, $fwmax ); + +=head2 tcjdbopen + + my $success = tcjdbopen( $jdb, 'casket', JDBOWRITER | JDBOCREAT ); + +=cut + +use constant { + JDBOREADER => 1 << 0, + JDBOWRITER => 1 << 1, + JDBOCREAT => 1 << 2, + JDBOTRUNC => 1 << 3, + JDBONOLCK => 1 << 4, + JDBOLCKNB => 1 << 5, +}; + +=head2 tcjdbclose + + my $success = tcjdbclose( $jdb ); + +=head2 tcjdbput + + my $success = tcjdbput( $jdb, $id, $text ); + +=head2 tcjdbput2 + + my $success = tcjdbput2( $jdb, $id, $text ); + +=head2 tcjdbout + + my $success = tcjdbout( $jdb, $id ); + +=head2 tcjdbsearch + + my $ids = tcjdbsearch( $jdb, $word, JDBSSUBSTR ); + +=cut + +use constant { + JDBSSUBSTR => 0, # substring matching + JDBSPREFIX => 1, # prefix matching + JDBSUFFIX => 2, # suffix matching + JDBFULL => 3, # full matching + JDBTOKEN => 4, # token matching + JDBTOKPRE => 5, # token prefix matching + JDBTOKSUF => 6, # token suffix matching +}; + +=head2 tcjdbsync + + my $success = tcjdbsync( $jdb ); + +=head2 tcjdboptimize + + my $success = tcjdboptimize( $jdb ); + +=head2 tcjdbvanish + + my $success = tcjdbvanish( $jdb ); + +=head2 tcjdbcopy + + my $success = tcjdbcopy( $jdb, '/path/of/copy' ); + +=head2 tcjdbpath + + my $path = tcjdbpath( $jdb ); + +=head2 tcjdbtnum + + my $number_of_records = tcjdbtnum( $jdb ); + +=head2 tcjdbfsiz + + my $file_size = tcjdbtsiz( $jdb ); + =cut =head1 KNOWN BUGS