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: Thu Sep 14 2000 - 04:02:27 GMT
At 01:30 AM 09/13/00 -0700, you wrote:
>Looking through your synopsis a thought rised: would it be possible 
>to think of swish as a database, I mean could it be accessible 
>through a DBI interface?

Hi Bas,

I thought about building a database driver for DBI, but I didn't really
feel like it fit into DBI that well.  Plus, it looks like more work,
considering I have no experience in writing a DBI driver.  But I don't
really see any reason why not.  I'll take a look at the DBI::DBD faq and
see what I can come up with.

  $dbh = DBI->connect( 'DBI:swish:myindex',$dbuser, $dbpassword, \%attr);

For the DSN what do you think?

  DBI:ForkSwish:index.swish-e
  DBI:LibSwish:non-stemmed
  DBI:ServerSwish:myindex
  DBI:OpenSwish:  <-- how to deal with non-forking platforms in a safe way?

Should one be able to change index files from prepare() to prepare() with
the same $dbh?  I'd say no.

Maybe the DSN should be DBI::ForkSwish and specify the index file(s) in
%attr.  That is maybe one of these:

  $dbh = DBI->connect( 'DBI:ForkSwish:indexes=index1,index2',$u, $p );
or
  $dbh = DBI->connect( 'DBI:ForkSwish:',$u, $p, { indexes => \@indexes} );

The second is my favorite.

Then the prepare:

  $sth = $dbh->prepare("-w $query -m $results $tflag $search_tags");

Well, I doubt we need SQL for the prepare.  But I would rather pass a hash
reference or object attributes as I'd rather not have to try and parse the
query string.  I guess I could also do something like my previous example:
  
  $dbh->query( 'subject=(apples or oranges)' );
or
  $sth = $dbh->prepare({ query => $query, %parameters});

then fetchrow() would do the real work.

Anyway, thanks very much for the comments.  Any other suggestions or ideas
are more than welcome.


Bill Moseley
mailto:moseley@hank.org
Received on Thu Sep 14 04:02:47 2000