def records_hep(): return { "filters": hep_filters(), "aggs": { **hep_author_affiliations_aggregation(1) }, }
def hep_author_citations(order=None): if order is None: order = count(start=1) return { "filters": hep_filters(), "aggs": { **hep_earliest_date_aggregation(order=next(order), title="Date of citing paper"), **hep_author_count_aggregation(order=next(order)), **hep_rpp(order=next(order)), **hep_doc_type_aggregation(order=next(order)), **hep_author_aggregation(order=next(order)), **hep_collaboration_aggregation(order=next(order)), **hep_author_affiliations_aggregation(order=next(order)), }, }
def test_hep_author_citations_cataloger_facets(inspire_app): with current_app.test_request_context(): expected_filters = { "author", "author_count", "doc_type", "earliest_date", "citation_count", "citation_count_without_self_citations", "collaboration", "refereed", "citeable", "collection", "curation_collection", "subject", "arxiv_categories", "self_affiliations", "affiliations", "self_author_names", "rpp", "self_curated_relation", "experiments", } expected_aggregations = { **hep_earliest_date_aggregation(order=1, title="Date of citing paper"), **hep_author_count_aggregation(order=2), **hep_rpp(order=3), **hep_doc_type_aggregation(order=4), **hep_author_aggregation(order=5), **hep_collaboration_aggregation(order=6), **hep_author_affiliations_aggregation(order=7), **hep_subject_aggregation(order=8), **hep_arxiv_categories_aggregation(order=9), **hep_collection_aggregation(order=10), } filters = current_app.config["CATALOGER_RECORDS_REST_FACETS"][ "hep-author-citations"]()["filters"].keys() aggregations = current_app.config["CATALOGER_RECORDS_REST_FACETS"][ "hep-author-citations"]()["aggs"] assert filters == expected_filters assert aggregations == expected_aggregations