The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

TM::Corpus::SearchAble - Topic Maps, Abstract Trait for searching

SYNOPSIS

   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

DESCRIPTION

This package is only abstract and it defines the minimal interface a trait which provides search functionality has to honor.

INTERFACE

index

$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 (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 of

Each result entry is a list (reference) containing (in sequence):

aid: assertion identifier
tid: local toplet identifier (to which that assertion belongs)
baseuri: the baseuri of the map

COPYRIGHT AND LICENSE

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.