You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by SGE0 <st...@hotmail.com> on 2009/10/23 18:10:15 UTC
Solrj client API and response in XML format (Solr 1.4)
Hi All,
After a day of searching I'm quite confused.
I use the solrj client as follows:
CommonsHttpSolrServer solr = new
CommonsHttpSolrServer("http://127.0.0.1:8080/apache-solr-1.4-dev/test");
solr.setRequestWriter(new BinaryRequestWriter());
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("qt", "dismax");
params.set("indent", "on");
params.set("version", "2.2");
params.set("q", "test");
params.set("start", "0");
params.set("rows", "10");
params.set("wt", "xml");
params.set("hl", "on");
QueryResponse response = solr.query(params);
How can I get the query result (response) in XML format out f?
I know it sounds stupid but I can't seem to manage that.
What do I need to do with the response object to get the response in XML
format ?
I already understood I can"t get the result in JSON so my idea was to go
from XML to JSON.
Thx for your answer already !
S.
System.out.println("response = " + response);
SolrDocumentList sdl = response.getResults();
--
View this message in context: http://www.nabble.com/Solrj-client-API-and-response-in-XML-format-%28Solr-1.4%29-tp26029197p26029197.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Solrj client API and response in XML format (Solr 1.4)
Posted by Noble Paul നോബിള് नोब्ळ् <no...@corp.aol.com>.
no need to use httpclient . use java.net.URL#openConnection(url) and
read the inputstream into a buffer and that is it.
On Sat, Oct 24, 2009 at 1:53 PM, SGE0 <st...@hotmail.com> wrote:
>
> Hi Paul,
>
> thx again.
>
> Can I use this technique from within a servlet ?
>
> Do I need an instance of the HttpClient to do that ?
>
> I noticed I can instantiate the CommonsHttpSolrServer with a HttpClient
> client .
>
> I did not find any relevant examples how to use this .
>
> If you can help me out with this much appreciated..
>
> Stefan
>
>
> Noble Paul നോബിള് नोब्ळ्-2 wrote:
>>
>> hi
>> you don't see the point . You really don't need to use SolrJ . All
>> that you need to do is just make an http request with wt=json and read
>> the output to a buffer and you can just send it to your client.
>> --Noble
>>
>>
>>
>> On Fri, Oct 23, 2009 at 9:40 PM, SGE0 <st...@hotmail.com> wrote:
>>>
>>> Hi All,
>>>
>>> After a day of searching I'm quite confused.
>>>
>>> I use the solrj client as follows:
>>>
>>> CommonsHttpSolrServer solr = new
>>> CommonsHttpSolrServer("http://127.0.0.1:8080/apache-solr-1.4-dev/test");
>>> solr.setRequestWriter(new BinaryRequestWriter());
>>>
>>> ModifiableSolrParams params = new ModifiableSolrParams();
>>> params.set("qt", "dismax");
>>> params.set("indent", "on");
>>> params.set("version", "2.2");
>>> params.set("q", "test");
>>> params.set("start", "0");
>>> params.set("rows", "10");
>>> params.set("wt", "xml");
>>> params.set("hl", "on");
>>> QueryResponse response = solr.query(params);
>>>
>>>
>>> How can I get the query result (response) in XML format out f?
>>>
>>> I know it sounds stupid but I can't seem to manage that.
>>>
>>> What do I need to do with the response object to get the response in XML
>>> format ?
>>>
>>> I already understood I can"t get the result in JSON so my idea was to go
>>> from XML to JSON.
>>>
>>> Thx for your answer already !
>>>
>>> S.
>>>
>>>
>>>
>>>
>>> System.out.println("response = " + response);
>>> SolrDocumentList sdl = response.getResults();
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Solrj-client-API-and-response-in-XML-format-%28Solr-1.4%29-tp26029197p26029197.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> -----------------------------------------------------
>> Noble Paul | Principal Engineer| AOL | http://aol.com
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Solrj-client-API-and-response-in-XML-format-%28Solr-1.4%29-tp26029197p26037037.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
--
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com
Re: Solrj client API and response in XML format (Solr 1.4)
Posted by SGE0 <st...@hotmail.com>.
Hi Paul,
thx again.
Can I use this technique from within a servlet ?
Do I need an instance of the HttpClient to do that ?
I noticed I can instantiate the CommonsHttpSolrServer with a HttpClient
client .
I did not find any relevant examples how to use this .
If you can help me out with this much appreciated..
Stefan
Noble Paul നോബിള് नोब्ळ्-2 wrote:
>
> hi
> you don't see the point . You really don't need to use SolrJ . All
> that you need to do is just make an http request with wt=json and read
> the output to a buffer and you can just send it to your client.
> --Noble
>
>
>
> On Fri, Oct 23, 2009 at 9:40 PM, SGE0 <st...@hotmail.com> wrote:
>>
>> Hi All,
>>
>> After a day of searching I'm quite confused.
>>
>> I use the solrj client as follows:
>>
>> CommonsHttpSolrServer solr = new
>> CommonsHttpSolrServer("http://127.0.0.1:8080/apache-solr-1.4-dev/test");
>> solr.setRequestWriter(new BinaryRequestWriter());
>>
>> ModifiableSolrParams params = new ModifiableSolrParams();
>> params.set("qt", "dismax");
>> params.set("indent", "on");
>> params.set("version", "2.2");
>> params.set("q", "test");
>> params.set("start", "0");
>> params.set("rows", "10");
>> params.set("wt", "xml");
>> params.set("hl", "on");
>> QueryResponse response = solr.query(params);
>>
>>
>> How can I get the query result (response) in XML format out f?
>>
>> I know it sounds stupid but I can't seem to manage that.
>>
>> What do I need to do with the response object to get the response in XML
>> format ?
>>
>> I already understood I can"t get the result in JSON so my idea was to go
>> from XML to JSON.
>>
>> Thx for your answer already !
>>
>> S.
>>
>>
>>
>>
>> System.out.println("response = " + response);
>> SolrDocumentList sdl = response.getResults();
>> --
>> View this message in context:
>> http://www.nabble.com/Solrj-client-API-and-response-in-XML-format-%28Solr-1.4%29-tp26029197p26029197.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
>
>
--
View this message in context: http://www.nabble.com/Solrj-client-API-and-response-in-XML-format-%28Solr-1.4%29-tp26029197p26037037.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Solrj client API and response in XML format (Solr 1.4)
Posted by Noble Paul നോബിള് नोब्ळ् <no...@corp.aol.com>.
hi
you don't see the point . You really don't need to use SolrJ . All
that you need to do is just make an http request with wt=json and read
the output to a buffer and you can just send it to your client.
--Noble
On Fri, Oct 23, 2009 at 9:40 PM, SGE0 <st...@hotmail.com> wrote:
>
> Hi All,
>
> After a day of searching I'm quite confused.
>
> I use the solrj client as follows:
>
> CommonsHttpSolrServer solr = new
> CommonsHttpSolrServer("http://127.0.0.1:8080/apache-solr-1.4-dev/test");
> solr.setRequestWriter(new BinaryRequestWriter());
>
> ModifiableSolrParams params = new ModifiableSolrParams();
> params.set("qt", "dismax");
> params.set("indent", "on");
> params.set("version", "2.2");
> params.set("q", "test");
> params.set("start", "0");
> params.set("rows", "10");
> params.set("wt", "xml");
> params.set("hl", "on");
> QueryResponse response = solr.query(params);
>
>
> How can I get the query result (response) in XML format out f?
>
> I know it sounds stupid but I can't seem to manage that.
>
> What do I need to do with the response object to get the response in XML
> format ?
>
> I already understood I can"t get the result in JSON so my idea was to go
> from XML to JSON.
>
> Thx for your answer already !
>
> S.
>
>
>
>
> System.out.println("response = " + response);
> SolrDocumentList sdl = response.getResults();
> --
> View this message in context: http://www.nabble.com/Solrj-client-API-and-response-in-XML-format-%28Solr-1.4%29-tp26029197p26029197.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
--
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com