Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] SWISH-WebService-0.01

From: Eric Jobidon <eric(at)not-real.NeoPaper.net>
Date: Sat Feb 02 2008 - 08:05:00 GMT
Peter,
Thanks for the updated file. The module installed fine, and here are some
notes for the next person wanting to install it.

The WebService module can use either the SWISHED server via
SWISH::API::REMOTE or the perl object SWISH::API.
The example provided on the CPAN page demonstrates the SWISHED approach, so
heres a starting point for using a local index:


#!/usr/bin/perl
 use strict;
 use warnings;
 use CGI qw/ -newstyle_urls /;
 use SWISH::WebService;
 use SWISH::API;

 binmode STDOUT, ":utf8";
 my $cgi = CGI->new;
 my $o=SWISH::API->new('index/archive.idx');
 my $search = SWISH::WebService->new($cgi); 
 $search->swish($o); # Use the local SWISH index, not a remote one


 my $response = $search->search
  or croak $search->error;
 print $cgi->header($search->format); 
 print $response;


I experimented a bit with the remote objects, but had problems with my
Apache config. In my case, the index was local, so didn't really need the
remote options. But before I gave up, I realized that the properties of the
query (the $Props element in the WebService module) are not exported, so I
had to manually modify them in the .pm file to reflect my preferences
(whishlist: export the props)

And just to document my findings, at first I had not realized the SWISH::API
was accessible directly from the WebService module, so I tried to use the
SWISH::API::REMOTE with an index value set to a local script:
$search->index('http://localhost/lab/cgi-bin/search.cgi'); # watch out this
will likely not work

I was hoping to be able to use my own script with this, but the remote API
forces the parameter names to conform to what is expected by SWISHED. So a
query like:
	 GET /lab/cgi-bin/webservices.cgi?q=note2
triggerred this query:
	GET
/lab/cgi-bin/search.cgi?f=index/archive.idx&w=note2&p=swishdocpath&b=0&m=10

and obviously the parameter names did not match with what I had chosen in my
script.

I am just documenting this with the hope that it may save someone a few
hours of tinkering.
But Thanks again Peter for making this available. And as I experiment more
with the XML/HTML parsing, I'll be sure to share my suggestions and
potential improvements.

Eric


-----Original Message-----
From: users-bounces@lists.swish-e.org
[mailto:users-bounces@lists.swish-e.org] On Behalf Of Peter Karman
Sent: Friday, February 01, 2008 9:23 AM
To: Swish-e Users Discussion List
Subject: Re: [swish-e] SWISH-WebService-0.01



On 01/31/2008 08:56 PM, Eric Jobidon wrote:
> I am trying to build the WebService library available on CPAN and 
> after resolving most of the dependencies, I get stuck with an error 
> message to the effect that it can't locate object method "new" via 
> package "Search::Tools::XML". See log below.

I just uploaded 0.02 with a fix to CPAN. You can get it immediately if you
can't wait for the mirrors to propagate:

 http://peknet.com/~karpet/SWISH-WebService-0.02.tar.gz

That said, the 0.01 version was basically a prototype for something I ended
up implementing with Catalyst and Catalyst::Model::SWISH. If you find the
WebService package useful, please let me know, because it could use a
thorough refactoring to make it easier to use and to integrate with
persistent engines like mod_perl and fastcgi.


> If I explicitly include a "package Search::Tools::XML;" at the top of 
> the WebService.pm file, I get a different error message:
>  

you wanted 'use Search::Tools::XML' instead.

--
Peter Karman  .  peter(at)not-real.peknet.com  .  http://peknet.com/

_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users


_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Sat Feb 2 03:06:25 2008