Skip to main content.
home | support | download

Back to List Archive

Re: SWISHE Perl module - index headers

From: Bill Moseley <moseley(at)>
Date: Fri Oct 26 2001 - 19:42:28 GMT
At 06:19 AM 10/26/01 -0700, Alex Lyons wrote:
>Could you make _all_ the admin headers that are stored in the swish 
>index file (typically set in swish.conf) available for retrieval by the 
>Perl module interface SwishHeaderParameter?

I only saw one that was missing (well, two).  The missing one was
IndexName.  I've added that.  There's the Saved As: header, too, but I
assume you know the name of the index file if you are reading it.

>I have a perl CGI search script that currently calls the swish-e binary: 
>I would like to modify this to make it use the Perl module interface 
>instead, to make it more portable.

How does the perl module make it more portable?

>My CGI search script is generic, called as:
>arch spec)

I do hope you validate the path.

Frankly, I've never used those headers to identify the index.  I know
people do, but I would normally have the index files listed in the CGI
script or some config file -- that is, I'd know what index I was opening
before I opened it.

I guess if you had a system where one script creates indexes, and the
search script just gives access to whatever index files it finds in a given
directory would be one reason for using those headers.  But then you would
want the search CGI script to use nice titles when selecting which index to
search.  But if the CGI script doesn't know the titles that means it must
run swish on all the index files just to get the headers so you can display
a nice name in the CGI script.

I always have something like:

@indexes = (
      name  => 'Apache docs',
      index => 'apache.index',
     name   => 'Linux docs',
     index  => 'linux.index',

Then the query would be 
  http://(server)/(path)/swish-e.cgi?index=1&words=(search spec)

To select the linux index.
>So it uses the admin headers stored in the index to display information 
>to the user. In particular I currently grab the Name: header from the 
>swish-e output so that the results display tells the user what index is 
>being searched. But "Name" or "IndexName" is _not_ available from a call 
>to SwishHeaderParameter in the Perl module, although other admin headers 
>"IndexPointer" and "Description" are.  Surely an oversight??

Yes, an oversight.  There were two places that returned the same header, so
maybe a cut-n-paste error.

>BTW, could you use a consistent set of names for the headers accessed by 
>SwishHeaderParameter?  Either the header names as returned by Swish-e 
>(eg: Description, Pointer) or the names used in the swish.conf file (eg: 
>IndexDescription, IndexPointer), but please not a mixture.

I just changed them all to match the config settings in CVS.  Let me know
if that breaks anything and I can let both work.

#define DESCRIPTIONPARAMNAME "IndexDescription"
#define POINTERPARAMNAME "IndexPointer"

/* Other headers that can be looked via the swish-e library */
#define WORDCHARSPARAMNAME "WordCharacters"
#define BEGINCHARSPARAMNAME "BeginCharacters"
#define ENDCHARSPARAMNAME "EndCharacters"
#define STEMMINGPARAMNAME "Stemming"
#define SOUNDEXPARAMNAME "Soundex"

Bill Moseley
Received on Fri Oct 26 19:42:53 2001