Skip to main content.
home | support | download

Back to List Archive

RE: how do i get the description to print online

From: Wolf, Dena <dena.wolf(at)>
Date: Mon Dec 02 2002 - 19:23:51 GMT
You're right; I realized I should try it again!  I had been knocking my head
against the wall before before they increased the rbox size..  I had
followed your directions and installed the new swish. I thought I had it
down, but it didn't work no matter what I tried. I explained to my isp, so
then they installed the new swish, and then it still didn't work, so they
increased the rbox, and after that I should have gone back and grabbed the
cgi script.  Thanks!

-----Original Message-----
From: Bill Moseley []
Sent: Monday, December 02, 2002 2:02 PM
To:; Multiple recipients of list
Subject: Re: [SWISH-E] how do i get the description to print online

At 10:15 AM 12/02/02 -0800, Wolf, Dena wrote:
>Now, what do I do to my swish.cgi file so that this description prints out
>in folks webbrowsers when they search.  

If you use the swish.cgi script that comes with the distribution this is
already done -- with terms highlighted.  It should work with very little
need for configuration.  It would be faster than trying to figure out how
to patch this old script.  See below.

>Can you give me a very layperson
>answer on this one.  Here is the relevant part of my cgi file (I think):

I'm not going to edit that script for you.  But here's basically what you
need to do.  Here's a complete script.

#!/usr/bin/perl -w

my @fields = qw/

my $swish = './swish-e';
my $format_string = join '\t', map { "<$_>" } @fields;
my $query = 'not dkdkdkd';

# Warning -- unsafe method to call swish
open(SWISH, "$swish -w $query -m 5 -x '$format_string\\n'|")
   or die $!;

while ( <SWISH> ) {
    next unless /^\d/;
    my %properties;
    @properties{ @fields } = split /\t/;

    print "$properties{swishdocpath}:", 
          substr( $properties{swishdescription}, 0, 50 ),

But I think it's easier to use the script in the distribution.

Let's see how hard it is...  

~ $mkdir temp
~ $cd temp
~/temp $wget

~/temp $tar zxof swish-e-2.2.2.tar.gz

[no need to build since you have a current 2.2.x version of swish-e

~ $cd cgi-bin

~/cgi-bin $cp ~/temp/swish-e-2.2.2/example/swish.cgi .
~/cgi-bin $cp -rp ~/temp/swish-e-2.2.2/example/modules .

~/cgi-bin $pico .swishcgi.conf

~/cgi-bin $cat .swishcgi.conf 
return {
     swish_binary   => '/usr/local/bin/swish-e',
     title          => 'Search Apache Docs',

~/cgi-bin $cat c
IndexContents HTML* .shtml .html .htm
IndexOnly .html .shtml
StoreDescription HTML* <body> 20000
Metanames swishdocpath swishtitle

~/cgi-bin $swish-e -c c -i /usr/local/apache/htdocs   
Indexing Data Source: "File-System"
Indexing "/usr/local/apache/htdocs"
Indexing done!

~/cgi-bin $ls -la
total 1724
drwxr-xr-x   3         4096 Dec  2 10:55 .
drwxr-x--- 108         8192 Dec  2 10:51 ..
-rw-r--r--   1          106 Dec  2 10:53 .swishcgi.conf
-rw-r--r--   1          132 Dec  2 10:54 c
-rw-r--r--   1      1165536 Dec  2 10:55 index.swish-e
-rw-r--r--   1       469248 Dec  2 10:55 index.swish-e.prop
drwxr-xr-x   2         4096 Nov 14 11:10 modules
-rwxr-xr-x   1        88122 Dec  2 10:51 swish.cgi

That's it.

Bill Moseley
Received on Mon Dec 2 19:25:36 2002