Thanks, for some reason I got stopped with the fact that XMLWriter wanted 
SolrQueryRequest/Response instead of the NamedList available in solrj's 
QueryResponse and never looked at building those from the info I already had. 
It is working now.

For the comment on efficiency, I do have to agree that parsing to Java object 
and then serializing back is less than optimal to say the least. The reason it 
has to be done in our case is because the component acting as proxy also 
supports extra parameters for some of our business logic that will modify the 
incoming query in some cases, decide where it goes in others, etc. So to avoid 
rewriting the logic inside of CloudSolrServer, I want to reuse it (I really 
hate duplicating code). But the output is a Java object (QueryResponse), so I 
have to serialize it back. Unless there's a way to get the original message 
before it's unmarshaled into the QueryResponse, in which case I'd be more than 
happy to use that as-is. :)

Anyways, as I mentioned, it seems to be working for now. And I do use javabin 
between that component and Solr no matter what was asked in the request since I 
can then marshal it to anything.

Steve Molloy
Content Analytics Lead  |  R&D

Phone:

(514) 908-5406 406

Website:

www.opentext.com<http://www.opentext.com/>


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]<http://www.opentext.com/2/email-signature-logo>




<http://www.opentext.com/2/email-signature-event>

We can't solve problems by using the same kind of thinking we used when we 
created them.
Attributed to Albert Einstein

From: Per Steffensen [mailto:st...@designware.dk]
Sent: Tuesday, December 04, 2012 10:24 AM
To: dev@lucene.apache.org
Subject: Re: Solrj question

Believe there are no setParser method on CloudSolrServer?

Have you tried this:
XMLWriter.writeResponse(<a java.io.Writer for your XML output>, <your 
SolrQueryRequest>, <your SolrQueryResponse>)
It will require you to include solr-core, since that is where XMLWriter lives.

But it is a little inefficient, if I understand you correctly. If you have a 
CloudSolrServer doing a request and asks for a response in e.g. XML format, 
then this CloudSolrServer will receive a XML response over the wire, parse it 
into a SolrQueryResponse object and then you will take that SolrQueryResponse 
and serialize it back to XML. It would be nicer if you just used whatever was 
received on the wire directly.

Regards, Per Steffensen

Erick Erickson skrev:
haven't tried this personally, but try this:

server.setParser(new XMLResponseParser());





Best

Erick

On Mon, Dec 3, 2012 at 10:24 AM, Steve Molloy 
<smol...@opentext.com<mailto:smol...@opentext.com>> wrote:
I've been digging around a bit and could not find any straight-forward way of 
getting back the XML response after calling Solr using Solrj. The query method 
returns a QueryResponse object, which is great in most cases. But our use case 
implies pushing the response back to whatever format was requested, but still 
use the CloudSolrServer client. This is very easy with the javabin format, 
using the JavaBinCodec, but is there equivalent utilities to marshal into other 
formats from a NamedList? Otherwise, could the functionality be isolated for 
better reuse?

Thanks,

Steve Molloy
Content Analytics Lead  |  R&D

Phone:

(514) 908-5406 406<tel:908-5406%20406>

Website:

www.opentext.com<http://www.opentext.com/>


[http://www.opentext.com/2/emailsupport-logo-opentext-2010.gif]<http://www.opentext.com/2/email-signature-logo>

Nstein is now OpenText.
Please update your address book with my new email address.

This email message is confidential, may be privileged, and is intended for the 
exclusive use of the addressee. Any other person is strictly prohibited from 
disclosing or reproducing it. If the addressee cannot be reached or is unknown 
to you, please inform the sender by return email and delete this email message 
and all copies immediately.



<<inline: image001.gif>>

<<inline: image002.gif>>

Reply via email to