Shawn,

I do not know of an easy or a good way to do this.  It would be nice if there 
were a non-frail, programmatic way to get back DIH status but I don't think 
there is one.  I have a (monsterous) program that polls a running DIH handler 
every so often to get its status.  The crux is something like this:

DirectXmlRequest req = new DirectXmlRequest(requestUrl, null);
req.setMethod(METHOD.GET);
req.setParams(params);
NamedList<Object> nl = server.request("/dataimport");

String status = (String) nl.get("status");
String response = (String) nl.get("importResponse");

Map<String, String> msgs = (Map<String, String>) nl.get("statusMessages");
if(msgs!=null)
{
        String numReq = (String) msgs.get("Total Requests made to DataSource");
        String numRows = (String) msgs.get("Total Documents Processed");
        String docsSkipped = (String) msgs.get("Total Documents Skipped");
        String timeStarted = (String) msgs.get("Full Dump Started");
        String elapsed = (String) msgs.get("Time taken ");
        String aborted = (String) msgs.get("Aborted");
        String plaintextMsg = (String) msgs.get("");
}

Not sure this is what you're after, but maybe it'd be helpful.  Like I say, I 
wish [I knew of|there was] a better way to do this...

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


-----Original Message-----
From: Shawn Heisey [mailto:s...@elyograg.org] 
Sent: Wednesday, August 24, 2011 3:52 PM
To: solr-user@lucene.apache.org
Subject: Getting DIH status with SolrJ

I can't figure out how to get the particular information I need out of a 
Solr response with SolrJ.  I see that QueryResponse has a number of 
methods for getting specific information out, but as far as I can see, 
none of them have anything at all to do with the DIH.  I've started out 
with the following code.  The solrCore object is a CommonsHttpSolrServer 
that is defined at the class level and initialized by the constructor:

         ModifiableSolrParams p = new ModifiableSolrParams();
         p.set("qt", "/dataimport");
         QueryResponse qr = solrCore.query(p);

What do I do with qr?  I've been looking at the docs and cannot figure 
it out.  Can someone fill my poor clueless brain in on what I'm 
missing?  Is there a better approach than what I've got above?

 From the /dataimport response, I need to see the value of "status" and 
then I need to access several pieces of information under the 
"statusMessages" section.  I haven't been able to find an example.

Thanks,
Shawn

Reply via email to