Eric Jobidon wrote on 2/2/08 2:05 AM:
> 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;
croak() likely won't work there without 'use Carp' above.
> 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)
You should be able to just do:
$SWISH::WebService::Props = 'myprop, myprop2';
in your script before calling new(). It's a package var, but not private. (And
one of the things that should get refactored in a future version, as public
package vars are Not Good.)
>
> 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.
>
And thanks to you, Eric, for a detailed write-up.
pek
--
Peter Karman . http://peknet.com/ . peter(at)not-real.peknet.com
_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Sat Feb 2 23:53:15 2008