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 Alan Miller <al...@gmail.com> on 2011/11/18 12:30:35 UTC

handling query errors

I'm new to SolR and just got things working.

I can query my index & retrieve JSON results via: HTTP GET using: wt=json
and q=num_cpu parameters:
e.g.:
http://127.0.0.1:8080/solr/select?indent=on&version=2.2&q=num_cpu%3A16&fq=&start=0&rows=10&fl=*%2Cscore&qt=&wt=json&explainOther=&debugQuery=on

When the query is "syntactically correct" SolR responds with HTTP Status
200 and my JSON data.

When the query is "incorrect" (e.g. specifying an undefined field) SolR
responds with a HTTP status 400
with HTML that explains the error. For example when I submit "number_cpu"
instead of "num_cpu" I get:

  <h1>HTTP Status 400 - undefined field number_cpu</h1>
  <HR size="1" noshade="noshade">
  <p><b>type</b> Status report</p>
  <p><b>message</b> <u>undefined field number_cpu</u></p>
  <p><b>description</b> <u>The request sent by the client was syntactically
incorrect (undefined field number_cpu).</u></p>

What's the best way to programatically access the error message "undefined
field number_cpu"?
Is it possible to configure SolR to always return error messages in a
different way.

Thanks
Alan