On 1/24/07, Ken Krugler <[EMAIL PROTECTED]> wrote:
Hi Ryan,

>The big API question/style i'm struggling with is
>
>SolrResponse rsp = client.process( req );
>  vs
>SolrResponse rsp = req.execute( client );  // execute may not be the
>right word
>
>The first one is more natural, and is how things are actually
>processed.  The second one allows eliminates the need for lots of
>casting:
>
>SolrQueryResponse rsp = (SolrQueryResponse)client.process( req );
>vs
>SolrQueryResponse rsp = queryRequest.execute( client );
>
>Any thoughts?

Haven't dug into the client code, but my natural inclination would be
to go with the latter...it fits better with how I'd write the test
code if I was implementing such a thing. E.g. create a mock client
and then use that to test the request object.

I think I agree with the latter, although I probably would have coded
the former just because it would have occured to me first.

The latter allows an easy way to create new request classes w/o having
to couple tightly to the client.  A type of request could make two
calls two calls to the server, and join the responses or process them
in different ways.  I like it!

-Yonik

Reply via email to