db4b9f4d50af9e83733fc301c32e85cbe6d9c812,conceptnet5/builders/json_to_solr.py,,convert_to_solr,#Any#Any#,12

Before Change



def convert_to_solr(in_stream=None, out_stream=None):
    if in_stream is None:
        in_stream = sys.stdin
    if out_stream is None:
        out_stream = sys.stdout

    writer = SolrEdgeWriter(out_stream)
    
    for line in in_stream:
        if not line.strip():
            continue
        info = json.loads(line.strip().decode("utf-8"))
        writer.write(info)
    writer.close()

if __name__ == "__main__":
    convert_to_solr()

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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: commonsense/conceptnet5
Commit Name: db4b9f4d50af9e83733fc301c32e85cbe6d9c812
Time: 2014-02-25
Author: rob@luminoso.com
File Name: conceptnet5/builders/json_to_solr.py
Class Name:
Method Name: convert_to_solr


Project Name: Microsoft/nni
Commit Name: 2de52a8976971da4836727ba9242fedcc7474878
Time: 2020-01-16
Author: 656569648@qq.com
File Name: src/sdk/pynni/nni/compression/torch/compressor.py
Class Name: Pruner
Method Name: export_model


Project Name: biocore/scikit-bio
Commit Name: e144e814fa4b542fa70c5b4c167d1253a7a25342
Time: 2014-04-29
Author: josenavasmolina@gmail.com
File Name: skbio/maths/gradient.py
Class Name:
Method Name: make_groups


Project Name: home-assistant/home-assistant
Commit Name: 68c1dd7cd47c516df765a1742a62abca5c3d5f83
Time: 2015-09-14
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/automation/__init__.py
Class Name:
Method Name: setup