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

NAME

TM::Corpus::SearchAble::Plucene - Topic Maps, Trait for searching, Plucene implementation

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

DESCRIPTION

This trait extends an existing document corpus by search functionality. In that it leverages Plucene.

INTERFACE

index

$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.

Example:

   $co->search ('something');    # will search in content

   $co->search ('content:"something"'); # same

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.