Solr and SQL bugfixing