コード例 #1
0
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
コード例 #2
0
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
コード例 #3
0
ファイル: facet.py プロジェクト: tsgit/inspirehep
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)
コード例 #4
0
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
コード例 #5
0
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
コード例 #6
0
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
コード例 #7
0
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