Skip to main content.
home | support | download

Back to List Archive

Re: Perl and Swish-e 2.0

From: David Norris <dave(at)>
Date: Wed Aug 02 2000 - 17:29:50 GMT wrote:
> SWISHE::SwishOpen: Opens the index files and returns a handle.
> SWISHE::SwishSearch: Makes the search and returns the number
> of hits.
> SWISHE::SwishNext: Reads one result
> SWISHE:.SwishClose: Closes the handle

The structure looks very usable.  We'll probably want some way to pass
options.  But, that is a minor issue at this point.

A PHP interface might look like swishe_open(), swishe_search(),
swishe_next(), swishe_close().  PHP shares most of the PERL's language
constructs.  The rest of the example code would be nearly identical to



$properties="";   # No properties
#$properties="prop1 prop2 prop3"; 

$structure=1;       # Related to -t option of swish-e
$words='test';   # search string


print "Search Results: $num_results\n";
        print "$rank $filename \"$title\" $size \"$prop1\" \"$prop2\" 


> You can open as many handlers as you like.
> At this moment, there are some other things to do. The
> implementation is not thread-safe because there are several static
> variables defined in some of the functions of swish-e. It is also
> neccesary to check all the errors in a search in a better way (swish-
> e issues an exit after an error too often).

Dirk Nerinckx did some DLL work for Windows in a very early port.  In
fact, we both were using SWISH-E as ISAPI modules under MS-IIS at the
time (albeit unreliably).  

Dirk replaced all exit() calls with a C++ throw call in his code. 
Something similar could probably be done which would be more portable.
These two files:

,David Norris
  Dave's Web -
  Dave's Weather -
  ICQ Universal Internet Number - 412039
  E-Mail -

"I would never belong to a club that would have me as a member!"
                                                 - Groucho Marx
Received on Wed Aug 2 10:26:59 2000