Skip to main content.
home | support | download

Back to List Archive

Re: How to use 'user-config' in search.cgi using SWISH::API

From: Bill Moseley <moseley(at)>
Date: Wed May 05 2004 - 14:19:05 GMT
On Wed, May 05, 2004 at 05:57:04AM -0700, Peter Morling wrote:
> how do i use the user-config from 'swish.cgi' in 'search.cgi' ?
> Meaning, i would like to set configurations for e.g.,
> page_size,
> title_property
> description_prop
> max_chars
> and so on?

You can't.  Those are config options for swish.cgi not for search.cgi.
search.cgi was designed to be a lot more simple that swish.cgi and not
as generic as swish.cgi.  search.cgi is suppose to be for those that
want to customize their own script.

The page size (number of hits per page) is hard-coded to be 15.  You can
modify it in the source code (you might want to allow passing in a page
size from the query parameters -- checking for a reasonable range, of

Setting title_property and description_prop is a display issue.  You
just modify the template to adjust what you want to display.  The
concept is that search.cgi does the query to find the results, but then
the template decides what to display.  When the template codes does:

    [% item.Property('swishrank') %]

it's actually calling into the swish-e library to fetch that data.  So,
unlike calling the swish-e binary, you don't have to define the
properties before making the query.

max_chars is also a display issue, and the highlight module can handle
that, to some degree.  Notice at the top of search.cgi:

my %highlight_settings = (
    show_words      => 8,  # number of words to show
    occurrences     => 5,   # number of words to show
    max_words       => 100, # max number of words to show if not highlighted words f
    highlight_on    => '<span class="highlight">',
    highlight_off   => '</span>',

> Also got the SWISH::API and mod_perl working and it is FAST however when
> restarting Apache still get this error:
> ---
> [Wed May 05 14:52:46 2004] [warn] Syntax error at C:/Program Files/Apache
> Group/Apache2/conf/httpd.conf:183 Global $r object is not available. Set:
>  PerlOptions +GlobalRequest
> in httpd.conf at C:/Perl/lib/ line 308.

You may need to ask on the mod_perl list for this, after you check the

Bill Moseley
Received on Wed May 5 07:19:05 2004