SWISH::API::Remote - Perl module to perform searches on a swished daemon server


SWISH-API-Remote documentation  | view source Contained in the SWISH-API-Remote distribution.

Index


NAME

Top

SWISH::API::Remote - Perl module to perform searches on a swished daemon server

SYNOPSIS

Top

	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

Top

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

Top

SWISH::API::Remote::Results, SWISH::API::Remote::Result

AUTHOR

Top

Josh Rabinowitz, <joshr@localdomain>

COPYRIGHT AND LICENSE

Top


SWISH-API-Remote documentation  | view source Contained in the SWISH-API-Remote distribution.