lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davis, Daniel (NIH/NLM) [C]" <daniel.da...@nih.gov>
Subject RE: Generating json response in custom requestHandler (xml is working)
Date Thu, 02 Apr 2015 17:03:30 GMT
I mean that you could use XSLTResponseWriter to generate exactly the format you want.   However,
I anticipate that if you already have a custom response, getting it to automatically generate
XML/JSON/Python/Ruby was an expectation, and may be a requirement.

Maybe you should look at the code - it could be that the standard response writer looks explicitly
at the "wt" parameter and does something using these other response writers that you should
copy.

-----Original Message-----
From: Davis, Daniel (NIH/NLM) [C] 
Sent: Thursday, April 02, 2015 1:00 PM
To: solr-user@lucene.apache.org
Subject: RE: Generating json response in custom requestHandler (xml is working)

Use XSLT to generate JSON?    But you probably actually do want both, and ruby/python, etc.

-----Original Message-----
From: Christian Reuschling [mailto:christian.reuschling@gmail.com] 
Sent: Thursday, April 02, 2015 12:51 PM
To: solr-user@lucene.apache.org
Subject: Generating json response in custom requestHandler (xml is working)

Hi,

I managed it to create a small custom requestHandler, and filled the response parameter with
 some static values in the structure I want to have later.

I can invoke the requestHander from the browser and get nicely xml with the data and structure
I had specified - so far so good. Here is the xml response:


<response>
	<lst name="responseHeader">
		<int name="status">0</int>
		<int name="QTime">17</int>
	</lst>
	<lst name="response">
		<double name="doubleAtt1">13.0</double>
		<double name="doubleAtt2">14.0</double>
		<int name="intAtt1">15</int>
		<double name="doubleAtt3">16.0</double>
		<double name="doubleAtt4">17.0</double>
		<arr name="slices">
			<lst>
				<double name="doubleAtt1">13.0</double>
				<double name="doubleAtt2">14.0</double>
				<int name="intAtt1">15</int>
				<double name="doubleAtt5">16.0</double>
				<double name="doubleAtt6">17.0</double>
				<arr name="ids">
					<str>id1</str>
					<str>id2</str>
					<str>id3</str>
					<str>id4</str>
				</arr>
			</lst>
			<lst>
				<double name="doubleAtt1">13.0</double>
				<double name="doubleAtt2">14.0</double>
				<int name="intAtt1">15</int>
				<double name="doubleAtt5">16.0</double>
				<double name="doubleAtt6">17.0</double>
				<arr name="ids">
					<str>id1</str>
					<str>id2</str>
					<str>id3</str>
					<str>id4</str>
				</arr>
			</lst>
		</arr>
	</lst>
</response>


Now I simply add &wt=json to the invocation. Sadly I get a

HTTP ERROR 404

Problem accessing /solr/etr_base_core/trends&wt=json. Reason:

    Not Found


I had the feeling that the response format is transparent for me when I write a custom requestHandler.
But it seems I've overseen something.

Does anybody have an idea?


Regards

Christian

Mime
View raw message