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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -