TM::Corpus::SearchAble - Topic Maps, Abstract Trait for searching
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 ->update # mandatory ->harvest; # optional # attach searchable behaviour Class::Trait->apply ($co => 'TM::Corpus::SearchAble::SomeImplementation'); $co->index ('/where/store/index/'); # build index warn Dumper $co->search ('content:"BBB"'); # search for something
This package is only abstract and it defines the minimal interface a trait which provides search functionality has to honor.
$co->index (...)
This method creates an index. Individual implementation may need additional parameters. The method returns the object itself.
@results = @{ $co->search ($phrase) }
This method takes a search phrase as input and delivers a list (reference) of results. Individual implementations will have special syntaxes for the search phrase, but they have to honor the following fields:
content
ref
tid
aid
Each result entry is a list (reference) containing (in sequence):
baseuri
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.