works with solr add doc in json.
did a little refactoring.