def main() -> None: resources = { 'stopwords_nl': manage_stopwords_nl, 'stopwords_en': manage_stopwords_en, 'labels_nl': manage_label_synonyms_nl, 'labels_en': manage_label_synonyms_en, 'uri_synonyms': manage_uri_synonyms, 'hierarchy_theme': manage_hierarchy_theme } utils.setup_logger(__file__) logging.info('managed_resource.py -- starting') parser = argparse.ArgumentParser(description='Maintain the Solr managed ' 'resources.') parser.add_argument('--collection', type=str, required=True, choices=solr_collections(), help='Which collection to manage the resource for') parser.add_argument('--resource', type=str, choices=resources.keys(), help='Which resource to manage', required=True) parser.add_argument('--reload', type=bool, nargs='?', default=False, const=True, help='To reload the collection afterwards') input_arguments = vars(parser.parse_args()) collection = SolrCollection(input_arguments['collection']) resources.get(input_arguments['resource'])(collection) if input_arguments['reload']: logging.info('reloading Solr collection') collection.reload() logging.info('managed_resource.py -- finished')
def main() -> None: utils.setup_logger(__file__) parser = argparse.ArgumentParser(description='Reloads a Solr collection') parser.add_argument('--collection', type=str, required=True, choices=solr_collections(), help='Which collection to ' 'reload') input_arguments = vars(parser.parse_args()) logging.info('reload_collection.py -- starting') logging.info(' > collection: %s', input_arguments['collection']) collection = SolrCollection(input_arguments['collection']) collection.reload() logging.info('reload_collection.py -- finished')