lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: response writer 'default' action
Date Sun, 04 Mar 2007 22:56:12 GMT

: That list is not quite up-to-date, it should add:
:  * Document

Really? ... i guess i missed that one (i thought it had to be in a

:   * Collection should be changed to: Iterable
:  * Iterator

Collection changed to Iterable i remember (that was totally backwards
compatably) adding Iterator didn't click for me.

: Yes, I'm suggesting we say what happens if you add an Object not on
: the list.  I think the most reasonable behavior is to say: "Objects
: not contained in this list will be treated as a String using the value
: returned from Object.toString()"

i was mainly just pointing out that changes like that affect people who
have already written their own ResponseWriters ... i'd prefer not to do
that in backwards INcompatible ways without a really good reason.

: > personaly, i'd prefer we encourage RequestHandler writers to stick to that
: > contract and unwind their objects themselves so that their RequestHandlers
: > can be reused with any ResponseWRiter
: how would treating Objects as "toString()" limit what ResponseWriters
: could be used?  Am i missing something?

i was refering to ResponseWriters written for older versions of hte
contract: that don't expect anything not on that list.

in general, i think it's better if RequestHandlers unwind the object
because that way any errors happen well before the writer starts to
generate the response (while there is still time to deal with the error,
and well before any risk of the HTTP response already being flushed so
that we can't change the HTTP status code.

besides which a RequestHandler is in a better position to say
response.add(obj.toString()) and know that is the right thing to do then a
ResponseWriter ... you might have a bug in your RequestHandler that causes
it to put hte wrong thing in the response and not understand where the
weird string in your response is coming from ... letting hte
ResponseWriter throw an error (or return the debuging info it currently
does) forces you to do the right thing in your RequestHandler.

: The thing that is nice about allowing an Object in the response is
: that the you can pull it out later rather then a unwound version.  In

...that's what SOlrQueryRequest.getContext() is for, the response should
really only be for data you genuniely want returned (unwound into simple
primitives so there's less risk of error once your RequestHandler no
longer has any control over it)


View raw message