def get_subsidiary_institutions(data): query_results = InstitutionsSearch.get_subsidiary_institutions( data, source=["legacy_ICN", "control_number"] ) results = [ query_result.to_dict() for query_result in query_results.execute().hits ] return results
def test_indexer_deletes_record_from_es(inspire_app, datadir): data = json.loads((datadir / "902725.json").read_text()) record = create_record("ins", data=data) record["deleted"] = True record.index(delay=False) current_search.flush_and_refresh("records-institutions") expected_records_count = 0 record_lit_es = InstitutionsSearch().get_record(str( record.id)).execute().hits assert expected_records_count == len(record_lit_es)
def test_indexer_deletes_record_from_es(es_clear, db, datadir, create_record): data = json.loads((datadir / "902725.json").read_text()) record = create_record("ins", data=data) record["deleted"] = True record._index() es_clear.indices.refresh("records-institutions") expected_records_count = 0 record_lit_es = InstitutionsSearch().get_record(str( record.id)).execute().hits assert expected_records_count == len(record_lit_es)
def institutions(): return InstitutionsSearch()
def assert_record_is_deleted_from_es(): current_search.flush_and_refresh("records-institutions") expected_records_count = 0 record_lit_es = InstitutionsSearch().get_record(str(record.id)).execute().hits assert expected_records_count == len(record_lit_es)
def assert_record(): current_search.flush_and_refresh("records-institutions") record_from_es = InstitutionsSearch().get_record_data_from_es(institution_1) assert expected_number_of_papers == record_from_es["number_of_papers"]