
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->directory ('/where/store/index/');
$co->index; # build index
warn Dumper $co->search ('content:"BBB"'); # search for something
# if you already have an indexed corpus, then
my $co = ....
Class::Trait->apply ($co => 'TM::Corpus::SearchAble::SomeImplementation');
$co->directory ('/where/index/is/stored/');
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 implementations 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 (tokenized): the content of the referred documents, any names or the values of occurrences (if they are not URIs)
ref (tokenized): the URI references in occurrences
tid (as-is): the toplet identifier where the value is attached
aid (as-is): the assertion identifier where the value is part ofEach result entry is a list (reference) containing (in sequence):

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.