def reindex(): if has_role(current_user, 'admin'): reindex_all(recreate=True) push_data_keywords() admin_idx = AdminIndexer() admin_idx.reindex(recreate=True) return jsonify({"success": True}) else: return jsonify({"success": False, 'message': "You don't have sufficient privileges to " "perform this action."})
def find_duplicates_and_remove(): """Will go through the application to find any duplicates then remove them.""" inspire_ids = get_all_ids_in_current_system(prepend_id_with="") duplicates = [] for inspire_id in inspire_ids: matches = get_records_matching_field('inspire_id', inspire_id, doc_type=CFG_PUB_TYPE) if len(matches['hits']['hits']) > 1: duplicates.append(matches['hits']['hits'][0]['_source']['recid']) print('There are {} duplicates. Going to remove.'.format(len(duplicates))) do_unload(duplicates) # reindex submissions for dashboard view admin_indexer = AdminIndexer() admin_indexer.reindex(recreate=True)
def find_duplicates_and_remove(base_url): """Will go through the application to find any duplicates then remove them.""" inspire_ids = importer_api.get_inspire_ids(base_url=base_url) if inspire_ids is not False: duplicates = [] for inspire_id in inspire_ids: matches = get_records_matching_field('inspire_id', inspire_id, doc_type=CFG_PUB_TYPE) if len(matches['hits']['hits']) > 1: duplicates.append( matches['hits']['hits'][0]['_source']['recid']) print('There are {} duplicates. Going to remove.'.format( len(duplicates))) do_unload(duplicates) # reindex submissions for dashboard view admin_indexer = AdminIndexer() admin_indexer.reindex(recreate=True)
def find_duplicates_and_remove(): """ Will go through the application to find any duplicates then remove them. :return: """ inspire_ids = get_all_ids_in_current_system(prepend_id_with="") duplicates = [] for inspire_id in inspire_ids: matches = get_records_matching_field('inspire_id', inspire_id, doc_type=CFG_PUB_TYPE) if len(matches['hits']['hits']) > 1: duplicates.append(matches['hits']['hits'][0]['_source']['recid']) print('There are {} duplicates. Going to remove.'.format(len(duplicates))) do_unload(duplicates) # reindex submissions for dashboard view admin_indexer = AdminIndexer() admin_indexer.reindex(recreate=True)
def delete_submission(recid): """ Submissions can only be removed if they are not finalised, meaning they should never be in the index. :param recid: :return: """ if has_role(current_user, 'admin') or has_role(current_user, 'coordinator') \ or check_is_sandbox_record(recid): unload_submission(recid) admin_idx = AdminIndexer() admin_idx.reindex(recreate=True) return json.dumps({"success": True, "recid": recid, "errors": [ "Record successfully removed!"]}) else: return json.dumps( {"success": False, "recid": recid, "errors": [ "You do not have permission to delete this submission. " "Only coordinators can do that."]})
def reindex(): """Reindexes HEPSubmissions and adds to the submission index.""" admin_idx = AdminIndexer() admin_idx.reindex(recreate=True)
def reindex(): """Reindexes HEPSubmissions and adds to the submission index""" admin_idx = AdminIndexer() admin_idx.reindex(recreate=True)