def records_hep(): return { "filters": hep_filters(), "aggs": { **hep_self_author_affiliations_aggregation(1, "999108") }, }
def test_hep_author_publications_cataloger_facets(inspire_app): author = "1111_Jones" author_recid = "1111" with current_app.test_request_context(f"?author={author}"): 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", "self_curated_relation", "rpp", "experiments", } expected_aggregations = { **hep_earliest_date_aggregation(order=1, title="Date of paper"), **hep_author_count_aggregation(order=2), **hep_rpp(order=3), **hep_doc_type_aggregation(order=4), **hep_author_aggregation(order=5, author=author, title="Collaborators"), **hep_collaboration_aggregation(order=6), **hep_self_author_affiliations_aggregation(order=7, author_recid=author_recid), **hep_subject_aggregation(order=8), **hep_arxiv_categories_aggregation(order=9), **hep_self_author_names_aggregation(order=10, author_recid=author_recid), **hep_collection_aggregation(order=11), **hep_self_author_claimed_papers_aggregation(order=12, author_recid=author_recid), **hep_experiments_aggregation(order=13), } filters = set(current_app.config["CATALOGER_RECORDS_REST_FACETS"] ["hep-author-publication"]()["filters"].keys()) aggregations = current_app.config["CATALOGER_RECORDS_REST_FACETS"][ "hep-author-publication"]()["aggs"] assert filters == expected_filters assert aggregations == expected_aggregations
def hep_author_publications(order=None): if order is None: order = count(start=1) author = request.values.get("author", "", type=str) author_recid = author.split("_")[0] return { "filters": hep_filters(), "aggs": { **hep_earliest_date_aggregation(order=next(order)), **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), author=author, title="Collaborators"), **hep_collaboration_aggregation(order=next(order)), **hep_self_author_affiliations_aggregation(order=next(order), author_recid=author_recid), }, }