optimization - Solr Trigger Optimize And Check Progress From Java Code -


from topic there 2 ways trigger solr optimize java code.
either sending http request, or using solrj api.
how check progress of it?
say, api returns progress of optimize in percentage
or strings running/completed/failed.
there such api?

yes, optimize() in solrj api sync method.
here used monitor optimization progress.

cloudsolrclient client = null;     try {         client = new cloudsolrclient(zkclienturl);         client.setdefaultcollection(collectionname);         m_logger.info("explicit optimize of collection " + collectionname);         long optimizestart = system.currenttimemillis();         updateresponse optimizeresponse = client.optimize();          (object object : optimizeresponse.getresponse()) {             m_logger.info("solr optimizeresponse" + object.tostring());         }         if (optimizeresponse != null) {             m_logger.info(string.format(                     " elapsed time(in ms) - %d, qtime (in ms) - %d",                     optimizeresponse.getelapsedtime(),                     optimizeresponse.getqtime()));         }         m_logger.info(string.format(                 "time spent on optimizing collection %s :"                         + (system.currenttimemillis() - optimizestart)                         / 1000 + " seconds", collectionname));     } catch (exception e) {         m_logger.error("failed during explicit optimize on collection "                 + collectionname, e);     } {         if (client != null) {             try {                 client.close();             } catch (ioexception e) {                 throw new runtimeexception(                         "failed close cloudsolrclient connection.", e);             }             client = null;         }     } 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -