DB Solr script optimization