Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] Swish 2.4.5 working, SWISH::API seems to be working but isn't

From: Bernard T. Higonnet <bth(at)>
Date: Sat Feb 24 2007 - 17:36:48 GMT
On Saturday 24 February 2007 18:00, Peter Karman wrote:
> Bernard T. Higonnet scribbled on 2/23/07 5:36 PM:
> > Having done this, I told myself I would now try to get it working using
> > mod_perl, so I ran it under that. It turns out that swish/SWISH::API is
> > working under mod_perl. The $hits = $results->Hits; is still wrong, but
> > the actual search results are fine!
> it would be helpful to see the mod_perl code you are using and compare it
> to the non-mod_perl code.

This will probably lead to much embarassment, but since you ask...
In the code below, lines followed by  #---------------------------- are lines 
uncommented when running under mod_perl (except the pair setting $\ one of 
which must be commented as required). Finally, the 3rd-to-last line is just 
to show the results I'm interested in my case, I really think it has nothing 
to do with the problem

#!/usr/bin/perl -w
use diagnostics;
use strict;
my $debug=1;
$\="\n";   #----------------------------
#$\="<br>";   #----------------------------

sub chkerrors ($$) {
if (!$_[0]->Error) {print "$_[1] returned OK";return;}
my $badmsg = $_[0]->error_string;
print "$_[1]-$badmsg";
$badmsg = $_[0]->last_error_msg;
print "$_[1]2-$badmsg";

#use CGI qw(:standard);  #----------------------------
#use Apache::Connection;  #----------------------------
#print header(), start_html();  #----------------------------
print "";
my $swish=SWISH::API->new("/tmp/index.swish-e"); chkerrors($swish,"new");
my $results = $swish->query( "Bonnieux" ); chkerrors($swish,"query");
my $hits = $results->Hits; chkerrors($swish,"Hits");
print "Found ", $hits, " hits";
my $result=$results->next_result; chkerrors($swish,"next_result");
my $file;
while ($result=$results->next_result) {
  if (index($file,"/IND") > 3) {print $file;}
#print end_html();  #----------------------------
Users mailing list
Received on Sat Feb 24 12:34:18 2007