Slow Constellio admin interface

During a customer installation of Constellio 1.3, we have noticed an utterly slow loading of the admin interface, which is rather unusual (it is not that slow on other installs with the same amount of indexed content).
After an analysis, we have identified that the Constellio admin UI triggers every 5 seconds a query to its Solr, in order to know the number of indexed files, so as to update this figure in its admin UI. And in our particular installation, this query was taking an awful time to be processed (although the user queries were very fast). We could have changed the query frequency, but even the query by itself was slow. So we decided to change the query in order to have a much better query time.

Change the implementation of the method countIndexedRecords of the class com.doculibre.constellio.services.StatusServicesImpl with the following code, and voilĂ , your life will be brighter :

@Override
public int countIndexedRecords(RecordCollection collection) {
int count;
SolrServices solrServices = ConstellioSpringUtils.getSolrServices();
SolrServer solrServer = solrServices.getSolrServer(collection);
if (solrServer != null) {
SolrQuery q = new SolrQuery("*:*");
q.setRows(0);
q.setParam("collectionName", collection.getName());
q.setParam(ConstellioSolrQueryParams.USER_ID, "" + 1);
try {
QueryResponse queryResponse = solrServer.query(q);
count = (int) queryResponse.getResults().getNumFound();
} catch (SolrServerException e) {
throw new RuntimeException(e);
}
} else {
count = 0;
}
return count;
}