Skip to main content.
home | support | download

Back to List Archive

Re: [Ignor Postmaster] switching from swish.cgi to search.cgi

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Thu May 20 2004 - 14:48:57 GMT
On Thu, May 20, 2004 at 10:05:42AM -0400, Deepesh_Banerji@sybase.com wrote:
> 
> Good day,

Good day to you!

I'm cc'ing the swish-e list as that's where swish-e questions should go.


> So I'm trying to switch my search form file from swish.cgi (the big file
> that builds a swish-e.exe query and runs it each time) to the search.cgi
> file (the Perl API thats much faster and smaller). I'm using Apache 1.3 and
> Swish 2.4.2.

The swish.cgi script can use SWISH::API, too.  I think you just need to
set the "use_library => 1," option.

The difference between swish.cgi and search.cgi is that search.cgi
doesn't have all the extra, confusing, messy code to work with different
templating systems and use a config file to control its behavior.  It is
smaller, but I'm not so sure it would be much faster.

> HOWEVER, I'd like to keep using the same template that I was using before
> (ie the template I was using for swish.cgi). I'm aware that the swish.cgi
> template uses TemplateToolkit (TemplateHTMLTemplate.pm) to build the HTML
> page, where as search.cgi (the new, quicker Perl API file) uses
> HTML::Template (Template.pm) to build its HTML file.

No, search.cgi uses Template-Toolkit.  Template.pm is Template-Toolkit.

But, the templates are not compatible between the two.  Swish.cgi
template, in order to work in a general way with the other template
systems, gets passed very different data from the search.cgi template.
The search.cgi template just gets passed the raw data objects returned
from the SWISH::API query (for the most part).

> 
> So my question is, to make search.cgi work with TemplateToolkit, am I going
> to have to assign values to all the missing variables that search.cgi does
> not populate?

I'm not sure.  You can't just drop in the template from swish.cgi and
use it with search.cgi.  That would kind of defeat the purpose of
search.cgi (to have the template get passed the objects returned from
the SWISH::API query).

I'll bet it will be easier to use the template listed at the bottom of
search.cgi and start fresh.

-- 
Bill Moseley
moseley@hank.org
Received on Thu May 20 07:48:59 2004