for line in in_stream:
if not line.strip():
continue
info = json.loads(line.strip().decode("utf-8"))
writer.write(info)
writer.close()
After Change
if "surfaceText" in info and info["surfaceText"] is None:
del info["surfaceText"]
solr_struct = {"doc": info, "boost": boost}
solr_fragment = "\t"add": %s," % json.dumps(solr_struct)
print(solr_fragment, file=out)
print("\t"commit": {}", file=out)
print("}", file=out)