NAME
SWISH::API::Remote - Perl module to perform searches on a swished daemon server
SYNOPSIS
use SWISH::API::Remote;
my $index = "DEFAULT"; # use the default index
my %options = ( TIMEOUT => 4, DEBUG => 0 );
my $sw = SWISH::API::Remote->new( 'http://localhost/swished', $index, \%options);
# params to SWISH::API::Remote::new are URL, INDEXNAME, and OPTIONSHASHREF
# set the url to your swished server!
my $w = "foo OR bar"; # your search here
my $results = $sw->Execute( $w );
printf("Fetched %d of %d hits for search on '%s'\n",
$results->Fetched(), $results->Hits(), $w);
while ( my $r = $results->NextResult() ) { # loop over results and show properties
print join(" ", map { $r->Property($_) } ($r->Properties()) ) . "\n";
}
if ($results->Error()) {
die $results->ErrorString();
}
DESCRIPTION
Performs searches on a remote swished server using an interface similar to SWISH::API
- my $remote = SWISH::API::Remote->new( "http://yourserv.com/swished", ["INDEX", \%remote_options]);
-
Creates a SWISH::API::Remote object. The first parameter is the url of the swished server, (which gets appended with '?' and an appropriate query string). If not passed, INDEX is set to DEFAULT. If remote_options are used, $options{DEBUG} and $options{TIMEOUT} (which is used as the timeout for the swishedserver and defaults to 3 seconds) are the only recognized keys of %options so far.
- my $results = $remote->Execute( $search, \%search_options);
-
Performs a search using SWISH::API::Remote and returns a SWISH::API::Results object. Recognized search_options are: MAX: the maximum number of hits to fetch (default 10) BEGIN: which hit to start at (default 0) PROPERTIES: comma delimited list of properties to fetch (default "swishrank,swishdocpath,swishtitle,swishdocsize") HEADERS: return all index headers (default 0) CHARS: return character information (default 0) META: return Metadata from index (default 0)
SEE ALSO
SWISH::API::Remote::Results, SWISH::API::Remote::Result
AUTHOR
Josh Rabinowitz, <joshr@localdomain>
COPYRIGHT AND LICENSE
Copyright (C) 2004-2006 by Josh Rabinowitz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.