Fixing the 400 Bad Request problem with Solr 3.1.0 and Ruby-Solr
After seeing a tweet by Matt Biddulph the other day, mentioning that a Solr had a new 3.1 release, I thought I’d take a look. I decided to replace the 1.4 version we have at work, even though we are currently scratching the surface of what Solr can bring to a project.
Anyway, the install seem to go smoothly, and the admin screen was up and navigable. I went to one the application we have running against it though, and saw nothing but “Bad Request 400″ errors. Strange. Initially I thought the problem was down to the ruby-solr gem I was using, but with further investicgation it proved to be a Solr problem. Going to the admin area, and in the “Make a Query” section clicking “full interface“, I would make a query and get the same error! If I removed ‘standard’ from the query type things worked ok.
Checking the solrconfig.xml config file and you will see there is a line:
<requestHandler name="search" class="solr.SearchHandler">
I changed this to
<requestHandler name="standard" class="solr.SearchHandler">
and everything was fixed for me. It looks like someone changed the Handler name? anyway it was expecting a requestHandler with a name standard by default. This is also why ruby-solr was bailing.
Now I’m no Solr expert here, so if anyone has a clearer explanation I love to here it. Further searching has since found this is a bug which appears to have been fixed, but you’ll have to wait for the next release to see it.