mfares / solrpy

Automatically exported from code.google.com/p/solrpy
0 stars 0 forks source link

GET instead of POST for Select Queries #24

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I am using varnish-cache with solr. Varnish-cache is unable to properly cache 
the results as solrpy is using POST for selects

Expected:
Select request --> solrpy <-(get)-> varnish-cache <-(get)-> solr (Uncached)
Select request --> solrpy <-(get)-> varnish-cache (Cached)

What is happening instead:
Select request --> solrpy <-(post)-> varnish-cache <-(post)-> solr (Uncached)

Varnish treats all POSTs as uncacheable, all GETs as cacheable. Since no data 
is modified in a solr Select, should GET instead of POST be used?

Original issue reported on code.google.com by koony...@gmail.com on 6 Oct 2010 at 9:21

GoogleCodeExporter commented 8 years ago
I think we should allow user choose what to use, but not default to GET, 
because this would probably break a lot of long queries.

Most of the clients (and web servers) have a small default maximum header size 
limit where the default maximum POST body size limit is in most cases larger.

Original comment by tomaz.muraus on 11 Nov 2010 at 3:34

GoogleCodeExporter commented 8 years ago
I too wanted to get varnish to cache my Solr-requests; so I did some coding.
The result is here, https://github.com/plundra/solrpy/

Not that much tests done, only the built in test-suite (which has been updated 
to fit the new code in some places).

What SHOULD be done in the future: Instead of a rough estimate on the 
URI-limit; try a GET no matter its length and handle the HTTP 414-response from 
the server, using POST as fallback.

Original comment by plundran...@gmail.com on 1 Jul 2011 at 10:54