Skip to main content.
home | support | download

Back to List Archive

Re: RFC - swish interface for Perl

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Mon Sep 18 2000 - 01:08:57 GMT
After talking with a few people on the dbi-dev and dbi-users lists and
reviewing the DBI specification I decided to not write a DBI interface for
swish.  Maybe later.

I've got an early module for alpha testing.  Try at your own risk.

Again, I'm looking mostly for feedback on the interface and for some
testing on other platforms (I'm running linux).  This won't work on Windows
yet: it's pure perl but the fork will cause problems.  I haven't decided
how to deal with Windows (short of removing it from my machine...)

Here's basically what the interface looks like:

    use SWISH;

    $sh = SWISH->connect('Fork',
        prog     => '/usr/local/bin/swish-e',
        indexes  => 'index.swish-e',
        results  => sub { print $_[1]->as_string,"\n" },
    );

    die $SWISH::errstr unless $sh;

    $hits = $sh->query('metaname=(foo or bar)');
    ...
    $more_hits = $sh->query('some "phrase here" search');

I'd hope that your "results" callback routine does more than that.

The SWISH.pm module is used to bring in the "driver" for the method of
access. Currently, there's only the "Fork" method.  You need to install the
SWISH module first, then install the SWISH::Fork module, as SWISH::Fork
requires SWISH to be installed.

http://www.hank.org/modules/ has the modules and the POD.

The code needs to be cleaned up, of course.  I'll try and work on that
later this week.

One thing that I'm not thrilled about is searching multiple index files as
the headers get injected to the results before each index file.  It means
you don't know the total number of hits at the start of the search.

I'd be interested to know if I should include the stemming module, and the
"swish_words" function.  Those are required for highlighting search terms
and phrases in search documents and others might find them useful.

Thanks,

Bill Moseley
mailto:moseley@hank.org
Received on Mon Sep 18 01:09:39 2000