Nice, valid xml. But If I have an error (for example, <commit></comit>) I
get an HTML page back.


In 1.2, if you map /update to the XmlUpdateHandler in solrconfig.xml, errors are returned with an HTTP status error (ie, something != 200) + message. Your servlet runner (Jetty, Tomcat, etc) will format this as HTML.

This tends to confuse the client software.

Depends how the client is written ;)

The other option is to check the HTTP status on response. It is nice to get a 400 when the input is wrong, a 401 if you are unauthorized to do something, a 500 is something went wrong on the server.


Is there a way to get a return like:

<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">1</int><exception>blah, blah,
blah</exeption><int name="QTime">0</int></lst>
</response>


Yes, you can go back to solr 1.1 style response by removing the mapping for /update in solrconfig.xml

Check the last paragraph in "Upgrading from Solr 1.1"
http://svn.apache.org/repos/asf/lucene/solr/tags/release-1.2.0/CHANGES.txt



I've actually written my own handler, but since XmlUpdateHandler does the
same thing, I thought it would make a simple example.


Hymm, for your own handler... you could catch your own exceptions and put them in the response. It was a design decision to only have response code 200 for valid responses and something != 200 for error cases.

ryan

Reply via email to