refactoring of solr query