Skip to main content.
home | support | download

Back to List Archive

Re: Making SWISH::API->new() accept a list?

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Wed Dec 01 2004 - 03:51:06 GMT
On Tue, Nov 30, 2004 at 08:36:45PM -0500, Lars Kellogg-Stedman wrote:
> > But you can't say $sw = SWISH::API->new( "index.1 index.2" ).  That
> > breaks existing code.
> 
> That's true.  I was aiming mostly for proof-of-concept; not a final
> solution :).  But I'm thinking...if you try to support "legacy" code, how
> do you differentiate between:
> 
>   (a) SWISH::API->new("/Users/lars/Documents/Office Files/index.1")
> 
> And:
> 
>   (b) SWISH::API->new("/Users/lars/index.1 /Users/lars/index.2")

Right, you can't.

> I guess you could have new(), instead of accepting a list of index files,
> accept either (a) a scalar containing a space-seperated list, or (b) a list
> reference:
> 
>   SWISH::API->new(["/path/to/index.1", "/path/to/index.2"]);

Yes, that's likely the way to go.  In addition, maybe allow this:

   my $sw = SWISH::API->new;  # nothing passed

   $sw->add_indexes( 'index.swish-e' );
   $sw->add_indexes( @list_of_others );

   my $results = $sw->Query( 'foo' );

That doesn't thrill me that much, though, but would allow more control
over the indexes.

The problem is then knowing when to "attach" (open) the indexes (that
is, delay calling SwishAttach).

-- 
Bill Moseley
moseley@hank.org

Unsubscribe from or help with the swish-e list: 
   http://swish-e.org/Discussion/

Help with Swish-e:
   http://swish-e.org/current/docs
   swish-e@sunsite.berkeley.edu
Received on Tue Nov 30 19:51:07 2004