Skip to main content.
home | support | download

Back to List Archive

Re: Ok..I tried that...

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Fri Jan 25 2002 - 18:24:37 GMT
At 09:28 AM 01/25/02 -0800, Rich Thomas wrote:
>I copied the swish.cgi to my apache/cgi-bin.  Edited the path where perl
>lives.  took out the -w and commented out the use strict.

Why would you take out -w and "use strict"?  Don't do that.

>Put X infront of daterange routine.

That's ok because it will require Date::Calc module which you may not have,
and that will just confuse things while trying to get things running.

>Now I get the search page fine but I
>get no results.  Not that it tells me there were no words found.  It just
>doesn't really even change the screen.

Ok, more below.


>I tried running the test.pl script in the perl directory and got the
>follwing error:

That has nothing to do with this.  the files in the perl directory are for
using the swish-e C library with perl.  You don't need that.


>I'm ready to start over from scratch.....

Ok, here we go. From scratch:

~ > mkdir rich
~ > cd rich
~/rich > cp ~/swish-e/example/swish.cgi .
~/rich > cp -rp ~/swish-e/example/modules .
~/rich > cp ~/swish-e/src/swish-e .

~/rich > ll
total 924
drwxr-xr-x   4 moseley  users        4096 Jan 21 23:59 modules/
-rwxr-xr-x   1 moseley  users      866413 Jan 25 09:56 swish-e*
-rwxr-xr-x   1 moseley  users       59061 Jan 25 09:52 swish.cgi*

Edit swish.cgi for date_ranges:

..tapity-tap

~/rich > diff swish.cgi ~/swish-e/example
429c429
<         Xdate_ranges     => {
---
>         date_ranges     => {

Now we need a tiny config file:
..tapity-tap

~/rich > cat swish.conf
IndexOnly .html
StoreDescription HTML <body> 100000
DefaultContents HTML

Index the data:

~/rich > ./swish-e -c swish.conf -i /usr/local/apache/htdocs
Indexing Data Source: "File-System"
Indexing "/usr/local/apache/htdocs"
Removing very common words...
no words removed.
Writing main index...
Sorting words ...
Sorting 6997 words alphabetically
Writing header ...
Writing index entries ...
  Writing word text: Complete
  Writing word hash: Complete
  Writing word data: Complete
6997 unique words indexed.
5 properties sorted.                                              
124 files indexed.  1485844 total bytes.  170115 total words.
Elapsed time: 00:00:02 CPU time: 00:00:01
Indexing done!

~/rich > ll
total 1928
-rw-r--r--   1 moseley  users     1011686 Jan 25 10:00 index.swish-e
-rw-r--r--   1 moseley  users       10966 Jan 25 10:00 index.swish-e.prop
drwxr-xr-x   4 moseley  users        4096 Jan 21 23:59 modules/
-rwxr-xr-x   1 moseley  users      866413 Jan 25 09:56 swish-e*
-rwxr-xr-x   1 moseley  users       59061 Jan 25 09:52 swish.cgi*
-rw-r--r--   1 moseley  users          52 Jan 25 09:59 swish.conf

Let's test the cgi script from the command line:

~/rich > ./swish.cgi | head
Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
       <title>
          Search our site
       </title>
    </head>
    <body>

Now, let's link it into someplace silly so it works from the outside:

~/rich > ln -s ~/rich ~/hankweb/images

Now tell apache that's it's a CGI script.  You may not need this on your
server if .cgi is automatically a CGI script, but I do on my Apache setup:

~/rich > cat .htaccess
<files swish.cgi>
   SetHandler cgi-script
</files>

Now, does it work?

~/rich > lynx http://hank.org/images/rich/swish.cgi

Swish-e home page Search our site

   install_________________________ Search!
   Limit search to: (*) Title & Body ( ) Title ( ) Document Path
   Sort by: [Rank______________] [ ] Reverse Sort
     _________________________________________________________

   Powered by Swish-e swish-e.org

   Valid HTML 4.01!

(now search for "install")

    Results for install   1 to 14 of 14 results. Run time: 0.037
   seconds | Search time: 0.000 seconds

   1 Apache 1.3 Dynamic Shared Object (DSO) support -- rank: 1000
          ... via configure 's --enable-shared option (see
          top-level INSTALL file) or by changing the AddModule
          command in ... your src/Configuration into a
          SharedModule command (see src/INSTALL file). After a
          module is compiled into a ... is simple: When
          installing Apache the configure 's make install

Bingo!


-- 
Bill Moseley
mailto:moseley@hank.org
Received on Fri Jan 25 18:27:55 2002