SWISH::Prog::Native::Indexer - wrapper around Swish-e binary
use SWISH::Prog::Native::Indexer; my $indexer = SWISH::Prog::Native::Indexer->new( invindex => SWISH::Prog::Native::InvIndex->new, config => SWISH::Prog::Config->new, count => 0, clobber => 1, flush => 10000, started => time(), ); $indexer->start; for my $doc (@list_of_docs) { $indexer->process($doc); } $indexer->finish;
The Native Indexer is a wrapper around the swish-e version 2.x binary tool.
Create indexer object. All the following parameters are also accessor methods.
A SWISH::Prog::InvIndex::Native object.
A SWISH::Prog::Config object.
The path to the swish-e executable. If empty, will just look in $ENV{PATH}.
swish-e
Takes same args as swish-e -v option.
swish-e -v
Takes same args as swish-e -W option.
swish-e -W
String of options passed directly to the swish-e program.
Initialize object. Called by new().
Returns true if the exe() executable works, false otherwise.
Start the indexer on its merry way. Stores the filehandle in fh().
Returns the $indexer object.
You likely don't want to pass cmd in but let start() construct it for you.
Get or set the open() filehandle for the swish-e process. CAUTION: don't set unless you know what you're doing.
You can print() to the filehandle using the SWISH::Prog index() method. Or do it directly like:
print { $indexer->fh } "your headers and body here";
The filehandle is close()'d by the finish() method.
Close the open fh() filehandle and check for any errors.
Called by the magic DESTROY method so $indexer will finish() whenever it goes out of scope.
merge() will merge @SWISH::Prog::Native::InvIndex objects together with the index named in the calling Indexer object.
Returns the $indexer object on success, croaks on failure.
process() will parse and index doc. doc should be a SWISH::Prog::Doc instance.
Will croak() on failure.
Add doc to the index.
Note this is slower than merge(). If you have multiple doc objects, create a new Indexer object and process() them all, then merge() the two InvIndex objects.
my $indexer = SWISH::Prog::Native::Indexer->new(invindex => 'tmpmerge'); $indexer->start; for my $doc (@list_of_docs) { $indexer->process($doc); } $indexer->finish; $indexer->merge( 'path/to/other/index' );
Peter Karman, <perl@peknet.com>
Please report any bugs or feature requests to bug-swish-prog at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SWISH-Prog. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-swish-prog at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc SWISH::Prog
You can also look for information at:
Mailing list
http://lists.swish-e.org/listinfo/users
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=SWISH-Prog
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/SWISH-Prog
CPAN Ratings
http://cpanratings.perl.org/d/SWISH-Prog
Search CPAN
http://search.cpan.org/dist/SWISH-Prog/
Copyright 2008-2009 by Peter Karman
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://swish-e.org/
To install SWISH::Prog, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SWISH::Prog
CPAN shell
perl -MCPAN -e shell install SWISH::Prog
For more information on module installation, please visit the detailed CPAN module installation guide.