You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Sharath Jagannath <sh...@gmail.com> on 2011/08/04 23:35:25 UTC
Json update using HttpURLConnection
I am trying to post the json update request using
java.net.HttpURLConnection.
Parameters I am using:
url : http://localhost:8983/solr/update/json?commit=true
String data =
"[{\"id\" : \"TestDoc7\", \"title\" : \"test 7\"}, {\"id\" :
\"TestDoc8\", \"title\" : \"another test 8\"}]";
uri += "&" + data;
String requestType = "POST";
Header info:
"Content-type", "application/json"
"Content-Length", "" + data.length()
I see, the request going to the solr server but the data is not being
persisted.
I was able to add the same documents with curl, I am sure there is something
stupid.
Any pointers on what might be the mistake.
Thanks,
Sharath
Re: Json update using HttpURLConnection
Posted by Sharath Jagannath <sh...@gmail.com>.
Never mind, It was some stupid bug.
Figured it out.
Cheers,
Sharath
On Thu, Aug 4, 2011 at 2:35 PM, Sharath Jagannath
<sh...@gmail.com>wrote:
> I am trying to post the json update request using
> java.net.HttpURLConnection.
>
> Parameters I am using:
>
> url : http://localhost:8983/solr/update/json?commit=true
>
> String data =
> "[{\"id\" : \"TestDoc7\", \"title\" : \"test 7\"}, {\"id\" :
> \"TestDoc8\", \"title\" : \"another test 8\"}]";
>
> uri += "&" + data;
>
> String requestType = "POST";
>
>
> Header info:
> "Content-type", "application/json"
> "Content-Length", "" + data.length()
>
>
> I see, the request going to the solr server but the data is not being
> persisted.
>
> I was able to add the same documents with curl, I am sure there is
> something stupid.
>
> Any pointers on what might be the mistake.
>
> Thanks,
> Sharath
>