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 - 00:38:40 GMT
On Tue, Nov 30, 2004 at 06:35:27PM -0500, Lars Kellogg-Stedman wrote:
> >   my $index1 = SWISH::API->new_index( 'index.1' );
> >   my $index2 = SWISH::API->new_index( 'index.2' );
> 
> I'd go for SWISH::API::Index->new(), myself.

Yes, that's what we were discussing.  But the index structure stores
the swish handle, so currently it can't be an independent object.

> And I'd probably try to do something about New_Search_Object, too
> :).

Like what?  You mean make it a separate class, too?  It's the same
situation in that it needs the swish handle.

> In any case, attached to this message is a diff against 2.4.2 that adds the
> following:
> 
>   (1) The new() function now takes a perl list:
> 
>         $sw = new SWISH::API [ index [, index ] ]
> 
>       So you can say:
> 
>         $sw = new SWISH::API "index.1";
> 
>       Or:
> 
>         $sw = new SWISH::API "index.1", "index.2";

But you can't say $sw = SWISH::API->new( "index.1 index.2" ).  That
breaks existing code.

>       The above calls will add the indexes and call SwishAttach().
> 
>   (2) The new() function can be called with an empty parameter list:
> 
>         $sw = new SWISH::API;
> 
>       In this case, you get a new handle but no indexes.  You can then:
> 
>         $sw->addindex("index.1");
>         $sw->addindex("index.2");
>         $sw->attach;

I need to look at the code.  I don't see why attach couldn't be called
upon the first call that needs to read the index.  And $sw->addindex()
could die if calling after an attach.





-- 
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 16:38:42 2004