def test_aggregations(app): """Test aggregations.""" with app.test_request_context(''): search = Search().query(Q(query='value')) defs = dict(type=dict(terms=dict(field='upload_type'), ), subtype=dict(terms=dict(field='subtype'), )) assert _aggregations(search, defs).to_dict()['aggs'] == defs
def test_aggregations(app, user_factory): """Test aggregations.""" with app.test_request_context(""): q = Query("value") defs = dict(type=dict(terms=dict(field="upload_type"), ), subtype=dict(terms=dict(field="subtype"), )) assert _aggregations(q, defs).body['aggs'] == defs
def inspire_facets_factory(search, index): urlkwargs = MultiDict() facets = get_facet_configuration(index) if facets is not None: search = _aggregations(search, facets.get("aggs", {})) return (search, urlkwargs)
def test_aggregations(app): """Test aggregations.""" with app.test_request_context(''): search = Search().query(Q(query='value')) defs = dict( type=dict( terms=dict(field='upload_type'), ), subtype=dict( terms=dict(field='subtype'), ) ) assert _aggregations(search, defs).to_dict()['aggs'] == defs
def test_aggregations(app, user_factory): """Test aggregations.""" with app.test_request_context(""): q = Query("value") defs = dict( type=dict( terms=dict(field="upload_type"), ), subtype=dict( terms=dict(field="subtype"), ) ) assert _aggregations(q, defs).body['aggs'] == defs
def default_inspire_facets_factory(search, index): urlkwargs = MultiDict() facets = get_facet_configuration(index) if facets: search = _aggregations(search, facets.get("aggs", {})) search, urlkwargs = _query_filter(search, urlkwargs, facets.get("filters", {})) search, urlkwargs = _post_filter(search, urlkwargs, facets.get("post_filters", {})) return search, urlkwargs
def default_inspire_facets_factory(search, index): urlkwargs = MultiDict() facets = get_facet_configuration(index) if facets: search = _aggregations(search, facets.get("aggs", {})) search, urlkwargs = _query_filter( search, urlkwargs, facets.get("filters", {})) search, urlkwargs = _post_filter( search, urlkwargs, facets.get("post_filters", {})) return search, urlkwargs