On 7/11/2013 4:12 PM, John Randall wrote:
I want to use a browser and use HTTP POST to add a single document (not a file)
to Solr. I don't want to use cURL. I've made several attempts, such as the
following:
http://localhost:8080/solr/update?commit=true&stream.type=text/xml&<add><doc><field
name="id">61234567</field><field name="title">WAR OF THE WORLDS</field>doc></add>
I get following message which makes it appear the POST was successful, but
when I query on the id, there are no results. I've commited in a separate post
too, but again, no results.
<?xml version="1.0" encoding="UTF-8" ?>
- <response>
- <lstname="responseHeader">
<intname="status">0</int>
<intname="QTime">15</int>
</lst>
</response>
This is actually not a POST. It's a GET -- that's the only kind of
request you can make from a browser with a URL that's typed or pasted.
In order to get a POST request from a browser, you need to have an HTML
page with an HTML form in it and submit that form. I'm not going to go
into how to do this here, because that is basic HTML stuff.
If you use the stream.body parameter for your XML update, you might be
able to use a GET request and have it actually work.
http://wiki.apache.org/solr/UpdateXmlMessages#Updating_via_GET
URL encoding the XML characters is required, as mentioned on that page.
I recently tried to do this myself on Solr 4.4-SNAPSHOT, and it didn't
work. I never did figure out why. It's probably more likely to work on
a 3.x version.
Thanks,
Shawn