Skip to main content.
home | support | download

Back to List Archive

Perl and Swish-e 2.0

From: <jmruiz(at)not-real.boe.es>
Date: Wed Aug 02 2000 - 17:03:09 GMT
Hi all,

Although, it is a very alpha implmentation, I would like to hear from
all of you about the API of the perl module.

Here is an example (sorry for the broken lines):

#!/usr/local/bin/perl

use SWISHE;

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

$handle=SWISHE::SwishOpen("../src/index.swish");

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

$num_results=SWISHE::SwishSearch($handle,$words,$structure,$
properties);

print "Search Results: $num_results\n";

while(($rank,$filename,$title,$size,$prop1,$prop2,$prop3)=SWISHE:
:SwishNext($handle))
{
        print "$rank $filename \"$title\" $size \"$prop1\" \"$prop2\" 
\"$prop3\"\n";
}

SWISHE::SwishClose($handle);

At this moment, this sample is working fine. There are four perl
functions (with their equivalents in C).:

SWISHE::SwishOpen: Opens the index files and returns a handle.
SWISHE::SwishSearch: Makes the search and returns the number 
of hits.
SWISHE::SwishNet: Reads one result
SWISHE:.SwishClose: Closes the handle

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).

If anybody wants to try or help, let me know

cu
Jose
Received on Wed Aug 2 13:06:41 2000