Robert Barta > TM-Corpus-0.07 > TM::Corpus::SearchAble::Plucene

Download:
TM-Corpus-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.02   Source   Latest Release: TM-Corpus-0.11

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::Plucene');

   $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. It follows the abstract trait outlined in TM::Corpus::SearchAble, so the documentation there applies.

INTERFACE ^

directory

Getter/setter method for the file location of the index. In this case this will be a directory (which will be created if it does not exist).

index

$co->index;

This method creates/updates the index.

search

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