At 21:02 -0700 13-09-2000, Bill Moseley wrote:
>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.
The definite guide to DBI is: Programming the Perl DBI, 2000,
Alligator Descartes & Tim Bunce. Published by O' Reilly isbn
1565926994.
http://www.oreilly.com/catalog/perldbi/
> $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?
If you plan different drivers for each access method that could be.
If you would write one 'do-it-all' DBI driver for swish i would expect:
DBI:Swish:fork:index.swish-e
DBI:Swish:lib:non-stemmed
DBI:Swish:server:host
DBI:Swish:open:
>Should one be able to change index files from prepare() to prepare() with
>the same $dbh? I'd say no.
I agree.
>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.
Some ideas to consider for the DSN:
"most drivers expect either a simple database name or, more often, a
set of one or more name/value pairs separated with semicolons."
"the DBD::CSV module treats a group of ... files in a common
directory as a database"
>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});
I think the point of prepare() in swish context is that there's a
check on passing a valid query. SQL might be overkill, but we do need
a way to handle the different query types to swish: the boolean
operators, phrases, document partflags, dates, pagination 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
--
-- /''' Bas Meijer mailto:bas@antraciet.com
c-OO http://antraciet.com Web Services
\ > Kerkstraat 19 Postbus 256 1400 AG Bussum
\&& t. +31 35 7502100 f. +31 35 7502111
Received on Fri Sep 15 09:31:59 2000