Can you use POST to run a query in Solr (/select)
Posted
by RyanFetz
on Stack Overflow
See other posts from Stack Overflow
or by RyanFetz
Published on 2010-06-08T11:56:47Z
Indexed on
2010/06/08
15:02 UTC
Read the original article
Hit count: 183
solr
|httpclient
I have queries that I am running against out solr index that sometimes have very long query parameters, I get errors when i run these queries, which i assume are do to the limit of a GET query parameters.
Here is the method I use to query (JSON), this is to show I am using the Http Extensions (the client i use is a thin wrapper for HttpClient) not an end to end solution. 90% of the queries run fine, it is just when the params are large i get the 500 error from solr. I have read somewhere you can use POSt's when doing the select command but have not found examples of how to do it. Any help would be fantastic!
public string GetJson(HttpQueryString qs)
{
using (var client = new DAC.US.Web.XmlHttpServiceClient(this.Uri))
{
client.Client.DefaultHeaders.Authorization = new Microsoft.Http.Headers.Credential("Basic", DAC.US.Encryption.Hash.WebServiceCredintials);
qs.Add("wt", "json");
if (!String.IsNullOrEmpty(this.Version))
qs.Add("version", this.Version);
using (var response = client.Get(new Uri(@"select/", UriKind.Relative), qs))
{
return response.Content.ReadAsString();
}
}
}
© Stack Overflow or respective owner