BitstringSearch - Perl extension for indexing text documents
use BitstringSearch;
# get BitstringSearch object $o = BitstringSearch->new();
# create and load database $result = $o->initDb( 'Name' => '/tmp/testDatabase', 'TotalDocs' => '500', 'MinChars' => '4', 'WordList' => '/usr/share/dict/words' );
# insert a text file $r = $o->insertTextFile( 'Name' => '/tmp/testDatabase', 'File' => $somefile );
# update an existing text file $r = $o->updateTextFile( 'Name' => '/tmp/testDatabase', 'File' => $somefile );
# removes an existing text file $r = $o->removeTextFile( 'Name' => '/tmp/testDatabase', 'File' => $somefile ); # search for documents containing a specific word @list = $o->searchWord( 'Name' => '/tmp/testDatabase', 'Word' => 'software' );
# list all documents indexed @list = $o->listAllFiles('/tmp/testDatabase');
Create an indexed database of your text documents using a dictionary of good words to index.
initDb
- Name => name of the database
- TotalDocs => total documents database will hold
- WordList => list of good words to index (default 500)
- MinChars => minimum characters in a word required for indexing (default 4)
insertTextFile
- Name => name of database to insert into
- File => name of file to insert
updateTextFile
- Name => name of database to update into
- File => name of file to update
removeTextFile
- Name => name of database to delete from
- File => name of file to remove
searchWord
- Name => name of database to search
- Word => return list of document containing Word
listAllFiles
- Name => name of the database to list inserted documents
None by default.
Look in the example directory for an example of usage.
DB_File Fcntl
Richard Zilavec, <rzilavec@linistrator.com>
Copyright 2003 by Richard Zilavec
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.