Export to GitHub

solr-php-client - issue #8

max size of GET query in search is reached. replace with POST fixes


Posted on May 7, 2009 by Quick Rabbit

What steps will reproduce the problem? 1. search() with a URL over a certain size

What is the expected output? What do you see instead? Instead of a result, Solr serves a comms. error (0)

What version of the product are you using? On what operating system? 1.2 on RHEL5

Please provide any additional information below. the search() method in Apache_Solr_Service was presumably exceeding a maximum size value. A quick goole pointed me at http://www.nabble.com/limit-on-query-size--td23301642.html which inturn lead me to look into the sourcecode and I noticed that the client was using GET. I modified the return call to use POST like so:

return $this->_sendRawPost($this->_searchUrl . $this->_queryDelimiter . $queryString);

And it seemed to improve. Is there any reason not to use POST by default in future or make it configurable?

Comment #1

Posted on May 11, 2009 by Happy Bird

sorry for the slow reply.

Yes, there are some reasons to use GET for searches rather than defaulting to a POST operation. The primary reason is that POST operations aren't cacheable by a reverse proxy. Solr is now capable of outputting configurable Cache-Control / Expires headers for responses. A system administrator can take advantage of this by setting up a reverse proxy between Solr clients and the service to cache these responses with the intention of removing load on Solr Service itself.

However, it makes sense to allow the user to choose. The SolrJ implementation added a way of specifying the method that should be used during a query, I'll do the same for my search method.

Comment #2

Posted on May 11, 2009 by Happy Bird

available as of r7

Comment #3

Posted on Oct 13, 2010 by Happy Bird

Issue 52 has been merged into this issue.

Status: Fixed

Labels:
Type-Defect Priority-Medium