Plucene::Plugin::FileDocument - turn a file into a document
my $writer = Plucene::Index::Writer->new(...); $writer->add_document(Plucene::Plugin::FileDocument->new($filename));
This is a Plucene::Document subclass for indexing an entire file on disk.
$writer->add_document(Plucene::Plugin::FileDocument->new($filename));
This loads the file with the given name, and turns it into a Plucene::Document.
By default two Text fields will be created: 'path', which is the full name of the file, and 'text' which is the content of the file.
Extra fields can can be added by passing a hash of { fieldname => subref } pairs to the constructor:
$writer->add_document(Plucene::Plugin::FileDocument->new($filename, lastmod => sub { (stat(+shift->{path}))[9] }, );
These subrefs will be passed a hashref of the 'path' and 'text'.
By default we assume you are using Plucene::Document and Plucene::Document::Field. If you are using subclasses of these instead, then you should override these methods accordingly.
Tony Bowden, based on example code from the Lucene benchmark suite.
Please direct all correspondence regarding this module to: bug-Plucene-Plugin-FileDocument@rt.cpan.org
Copyright (C) 2004-2005 Kasei This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Plucene::Plugin::FileDocument, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plucene::Plugin::FileDocument
CPAN shell
perl -MCPAN -e shell install Plucene::Plugin::FileDocument
For more information on module installation, please visit the detailed CPAN module installation guide.