TM::Corpus::SearchAble::Plucene - Topic Maps, Trait for searching, Plucene implementation
use TM; my $tm = .... # get map from somewhere use TM::Corpus; # see this package my $co = new TM::Corpus (map => $tm); # bind map with document repository $co->update; # mandatory $co->harvest; # optional # attach searchable behaviour Class::Trait->apply ($co => 'TM::Corpus::SearchAble'); $co->index ('/where/store/index/'); # build index warn Dumper $co->search ('content:"BBB"'); # search for something
This trait extends an existing document corpus by search functionality. In that it leverages Plucene.
$co->index ($directory_path)
This method creates an index and stores everything into the provided directory.
@results = @{ $co->search ($phrase) }
This method takes a search phrase as input and delivers a list (reference) of results.
The search phrase will by default search in the content of the documents in the corpus.
content
Example:
$co->search ('something'); # will search in content $co->search ('content:"something"'); # same
Copyright 200[8] by Robert Barta, <drrho@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install TM::Corpus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TM::Corpus
CPAN shell
perl -MCPAN -e shell install TM::Corpus
For more information on module installation, please visit the detailed CPAN module installation guide.