I'm experiencing something weird while trying to post updates to Solr docs
via cURL from exec in Java runtime.  I can't figure out if this is something
strange with Solr's update mechanism, cURL, or Java runtime oddities, so
please excuse if I'm posting here incorrectly.  Any help would be greatly
appreciated.  Here's what I'm doing in Java:


String updateDoc = docXml.transform("resources/doc-to-update.xsl",
affiliation);

logger.info("Update document: " + updateDoc);

Runtime rt = Runtime.getRuntime();
FileUtility.write("resources/" + aggregatorId.replace(":", "") + ".xml",
updateDoc);
String command = "curl " + SOLR_ROOT + "/update?commit=true -H
\"Content-Type: text/xml\" --data-binary '<add><doc><field
name="id">ac:000001</field><field
name="affiliation">school</field></add>'";
logger.debug("Executing: " + command);
Process pr = rt.exec(command);

BufferedReader input = new BufferedReader(new
InputStreamReader(pr.getInputStream()));

String line=null;

while((line=input.readLine()) != null) 
{
     logger.debug(line);
}

int exitVal = pr.waitFor();
logger.info("Completed cURL process: " + exitVal);


So, executing the above does not update the Solr doc, however, I am getting
what looks like successful output from the BufferedReader:


<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int
name="status">0</int><int
name="QTime">278</int></lst>
</response>


I'm logging the actual command.  To debug, I've simply copied and pasted the
exact command that's getting executed via Java's process into the terminal
and executed there.  The command updates the doc when executed from the
Terminal, but not via Java's process execution.  Any ideas?

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-cURL-and-Java-runtime-tp2699317p2699317.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to