DIH & SolrJ don't really support what you want to do.  But you can make it work 
with code like this, which reloads the DIH configuration and checks for the 
response.  Just note this is quite brittle:  whenever the response changes in 
future versions of DIH, it'll break your code.

Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put("command", "reload-config");
SolrParams params = new MapSolrParams(paramMap);
DirectXmlRequest req = new DirectXmlRequest("/dataimporthandler", null);        
        
req.setMethod(METHOD.GET);
req.setParams(params);
NamedList<Object> nl = server.request(req);
String importResponse = (String) nl.get("importResponse");
boolean reloaded = false;
if("Configuration Re-loaded sucessfully".equals(importResponse)) {
        reloaded = true;
}

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: Billy Newman [mailto:newman...@gmail.com] 
Sent: Tuesday, November 06, 2012 3:00 PM
To: solr-user@lucene.apache.org
Subject: Access DIH from inside application (via Solrj)?

I know that you can access the DIh interface restfully which work
pretty well for most cases.  I would like to know however if it is
possible to send/receive commands from a DIH vai the Solrj library.
Basically I would just like to be able to kick off the DIH and maybe
check status.  I can work around this but java is not the best client
for handling/dealing with http/xml.  If I could use Solrj the code
would probably be a lot more straight forward.

Thanks guys/gals,

Billy


Reply via email to