Skip to main content.
home | support | download

Back to List Archive

Swish Library

From: Bill Moseley <moseley(at)>
Date: Sat Aug 19 2000 - 03:41:53 GMT
Hey, the library is nice!

I'm unclear a bit on using the library.  The test script below works fine
as shown.  But if I uncomment the SwishClose() I get segfaults.  If I
comment out SwishClose() and move the SwishOpen() out of the loop it also

What I'm wondering is how I open an index, and leave it open while I do
multiple searches.  Would/does it save much time to leave the handle open
for multiple searches.  (I'm thinking about mod_perl.)

I'm also need access to the header comments -- I use wordcharacters,
stemming, and the Swish Words all highlighting results.  I guess those are
on the todo list.

It does use some memory, though.  My mod_perl processes were going from 8MB
to over 20MB.  Is that expected?  Get twenty of so Apache children running
and that's a bit of memory (although I wonder how much is shared).  I also
wonder if it would use less memory to use a swish server process.  And I
wonder if that would be much slower.  

I'm running Linux 2.2.13, perl 5.6.0. with 128M.


#!/usr/local/bin/perl -w
use strict;

while (<>) {
    my $handle = SWISHE::SwishOpen( 'index.swish-e ') or
        die "no open";

    if (my $num_results = SwishSearch( $handle, $_, 1,'','') ) {

        print "Search Results: $num_results\n";

        while( my @results = SWISHE::SwishNext( $handle ) ) {
           print join (':', @results),"\n";
    } else {
        print "Search error: $num_results\n";

#    SWISHE::SwishClose($handle);

Bill Moseley
Received on Fri Aug 18 23:45:49 2000