Thanks Hoss for that very full response. I did have cursory look at
JSONResponseWriter but I must've missed the inner class. Thanks again.
Sean> Date: Tue, 29 Jan 2008 14:42:02 -0800> From: [EMAIL PROTECTED]> To:
solr-user@lucene.apache.org> Subject: RE: custom response writers> > > : Thats
what I thought, but I can't add a noarg constructor to my subclass > : as one
doesn't exist in the superclass - TextResponseWriter. All I have > : done is
create a class that extends TextResponseWriter and implements > :
QueryResponseWriter. The only method that is actually implemented is ..> : > :
public String getContentType(SolrQueryRequest arg0, SolrQueryResponse arg1) {>
: // TODO Auto-generated method stub> : return CONTENT_TYPE_TEXT_UTF8;> : }> :
ie the class at the moment, does nothing, but it shouldn't cause an error.> >
yeah ... actually it should ... there's a couple of things wrong with this >
picture... for starters, you must have some other code in your >
DojoResponseWriter2 or it wouldn't compile (you need to define the methods >
init(NamedList) and write(Writer,SolrQueryRequest,SolrQueryResponse) in > order
to satisfy the QueryResponseWriter Interface.> > Second: there is some
confusion about hte namming of utility classes > related to response writting
in Solr. The QueryResponseWriter is what you > have to implement. the
TextResponseWriter abstract class is intended to > help you do that ... but you
should not attempt to have a single > class subclass TextResponseWriter and
implement QueryResponseWriter.> > The intent is that each concrete
QueryResponseWriter impl will have a > helper class that it constructs
instances of in each call to the > QueryResponseWriter.write method. this
helper class can maintain state > and be recursive since there will be one
instance per response (meanwhile > the instanes of QueryResponseWriter need to
be thread safe.> > Think of QueryResponseWriter as an interface that your
factory must > implement, and TextResponseWriter as a base class you can use
for the > objects your factory will produce -- except that you never have to
return > the objects you produce, you just have to execute them.> > take a
loost at the existing JSONResponseWriter as an example ... in > implements
QueryResponseWriter but it does not extend TextResponseWriter > -- instead it
has an inner class named JSONWriter which extends > TextResponseWriter.> > >
-Hoss
_________________________________________________________________
Telly addicts unite!
http://www.searchgamesbox.com/tvtown.shtml