Oh this is good!

On Wed, Jun 26, 2013 at 12:05 PM, Shawn Heisey <s...@elyograg.org> wrote:

> On 6/25/2013 6:15 PM, Jack Krupansky wrote:
> > Are you using Tomcat?
> >
> > See:
> > http://wiki.apache.org/solr/SolrTomcat#Enabling_Longer_Query_Requests
> >
> > Enabling Longer Query Requests
> >
> > If you try to submit too long a GET query to Solr, then Tomcat will
> > reject your HTTP request on the grounds that the HTTP header is too
> > large; symptoms may include an HTTP 400 Bad Request error or (if you
> > execute the query in a web browser) a blank browser window.
> >
> > If you need to enable longer queries, you can set the maxHttpHeaderSize
> > attribute on the HTTP Connector element in your server.xml file. The
> > default value is 4K. (See
> > http://tomcat.apache.org/tomcat-5.5-doc/config/http.html)
>
> Even better would be to force SolrJ to use a POST request.  In newer
> versions (4.1 and later) Solr sets the servlet container's POST buffer
> size and defaults it to 2MB.  In older versions, you'd have to adjust
> this in your servlet container config, but the default should be
> considerably larger than the header buffer used for GET requests.
>
> I thought that SolrJ used POST by default, but after looking at the
> code, it seems that I was wrong.  Here's how to send a POST query:
>
> response = server.query(query, METHOD.POST);
>
> The import required for this is:
>
> import org.apache.solr.client.solrj.SolrRequest.METHOD;
>
> Gary, if you can avoid it, you should not be creating a new
> HttpSolrServer object every time you make a query.  It is completely
> thread-safe, so create a singleton and use it for all queries against
> the medline core.
>
> Thanks,
> Shawn
>
>

Reply via email to