<commit_before>from openspending.lib import solr_util as solr

def load(dataset):
    solr.build_index(dataset)
    return 0

def delete(dataset):
    solr.drop_index(dataset)
    return 0

def optimize():
    solr.optimize()
    return 0

def clean():
    s = solr.get_connection()
    s.delete_query('*:*')
    s.commit()
    return 0

def _load(args):
    return load(args.dataset)

def _delete(args):
    return delete(args.dataset)

def _optimize(args):
    return optimize()

def _clean(args):
    return clean()

def configure_parser(subparsers):
    parser = subparsers.add_parser('solr',
                              help='Solr index operations')
    sp = parser.add_subparsers(title='subcommands')

    p = sp.add_parser('load', help='Load data for dataset into Solr')
    p.add_argument('dataset')
    p.set_defaults(func=_load)

    p = sp.add_parser('delete', help='Delete data for dataset from Solr')
    p.add_argument('dataset')
    p.set_defaults(func=_delete)

    p = sp.add_parser('optimize', help='Optimize the Solr index')
    p.set_defaults(func=_optimize)

    p = sp.add_parser('clean', help='Empty/reset the Solr index')
    p.set_defaults(func=_load)<commit_msg>Fix typo in solr command<commit_after>from openspending.lib import solr_util as solr

def load(dataset):
    solr.build_index(dataset)
    return 0

def delete(dataset):
    solr.drop_index(dataset)
    return 0

def optimize():
    solr.optimize()
    return 0

def clean():
    s = solr.get_connection()
    s.delete_query('*:*')
    s.commit()
    return 0

def _load(args):
    return load(args.dataset)

def _delete(args):
    return delete(args.dataset)

def _optimize(args):
    return optimize()

def _clean(args):
    return clean()

def configure_parser(subparsers):
    parser = subparsers.add_parser('solr',
                              help='Solr index operations')
    sp = parser.add_subparsers(title='subcommands')

    p = sp.add_parser('load', help='Load data for dataset into Solr')
    p.add_argument('dataset')
    p.set_defaults(func=_load)

    p = sp.add_parser('delete', help='Delete data for dataset from Solr')
    p.add_argument('dataset')
    p.set_defaults(func=_delete)

    p = sp.add_parser('optimize', help='Optimize the Solr index')
    p.set_defaults(func=_optimize)

    p = sp.add_parser('clean', help='Empty/reset the Solr index')
    p.set_defaults(func=_clean)
{'fraction_non_alphanumeric': 0.1245819397993311, 'fraction_numerical': 0.0033444816053511705, 'mean_word_length': 3.506591337099812, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3074786', 'n_tokens_mistral': 811, 'n_tokens_neox': 793, 'n_words': 179}