public void publishDocument(JSONObject json) {
    SolrInputDocument doc = new SolrInputDocument();
    sTemplate =
        new org.springframework.data.solr.core.SolrTemplate(
            new org.apache.solr.client.solrj.impl.HttpSolrServer(
                "org.apache.solr.client.solrj.impl.HttpSolrServer"),
            "IPPS-core");

    try {

      doc.addField("provider_id", json.get("provider_id"));
      doc.addField("drg_definition", json.get("drg_definition"));
      doc.addField("provider_name", json.get("provider_name"));
      doc.addField("provider_street", json.get("provider_street_address"));
      doc.addField("provider_city", json.get("provider_city"));
      doc.addField("provider_zipcode", json.get("provider_zip_code"));
      doc.addField("provider_state", json.get("provider_state"));
      doc.addField(
          "hospital_referral_region_desc", json.get("hospital_referral_region_description"));
      doc.addField("total_discharges", json.get("total_discharges"));
      doc.addField("average_covered_charges", json.get("average_covered_charges"));
      doc.addField("average_total_payments", json.get("average_medicare_payments"));
      doc.addField("average_medicare_payments", json.get("average_medicare_payments_2"));

      sTemplate.saveDocument(doc);
      logger.info("Document has been published. Provider ID: " + json.get("provider_id"));
      sTemplate.commit();
    } catch (NullPointerException npe) {
      logger.error("Could not add Document, Missing Mandatory Data");
    } catch (Exception e) {
      logger.error("unable to commit the document to the Solr Instance");
    }
  }
  public void execute(Tuple input) {

    String provider_id = "" + input.getValue(0);
    JSONObject json = (JSONObject) input.getValue(1);
    logger.info("Publisher Bolt received Line:" + json);
    sTemplate =
        new org.springframework.data.solr.core.SolrTemplate(
            new org.apache.solr.client.solrj.impl.HttpSolrServer("http://localhost:8983"),
            "IPPS-core");

    sTemplate.deleteById(provider_id);
    sTemplate.commit();
    logger.info("Deleting Document from solr instance: Provider ID: " + provider_id);
    SolrInputDocument doc = new SolrInputDocument();
    try {

      doc.addField("provider_id", Long.parseLong((String) json.get("provider_id")));
      doc.addField("drg_definition", json.get("drg_definition"));
      doc.addField("provider_name", json.get("provider_name"));
      doc.addField("provider_street", json.get("provider_street_address"));
      doc.addField("provider_city", json.get("provider_city"));
      doc.addField("provider_zipcode", json.get("provider_zip_code"));
      doc.addField("provider_state", json.get("provider_state"));
      doc.addField(
          "hospital_referral_region_desc", json.get("hospital_referral_region_description"));
      doc.addField("total_discharges", Long.parseLong((String) json.get("total_discharges")));
      doc.addField(
          "average_covered_charges",
          Double.parseDouble((String) json.get("average_covered_charges")));
      doc.addField(
          "average_total_payments",
          Double.parseDouble((String) json.get("average_medicare_payments")));
      doc.addField(
          "average_medicare_payments",
          Double.parseDouble((String) json.get("average_medicare_payments_2")));

      sTemplate.saveDocument(doc);
      logger.info("Document has been published. Provider ID: " + json.get("provider_id"));
      sTemplate.commit();
    } catch (NullPointerException npe) {
      logger.error("Could not add Document, Missing Mandatory Data");
    } catch (Exception e) {
      logger.error("unable to commit the document to the Solr Instance" + e);
    }
    sTemplate.commit();
  }