def test_any_query(self): anymatcher = query.AnyMatcher() result = anymatcher({"any": "foo"}) assert result == { "simple_query_string": { "fields": ["quote", "tags", "text", "uri.parts"], "query": "foo", } }
def default_querybuilder(request): builder = query.Builder() builder.append_filter(query.AuthFilter(request)) builder.append_filter(query.UriFilter(request)) builder.append_filter(query.GroupFilter()) builder.append_filter(query.UserFilter()) builder.append_matcher(query.AnyMatcher()) builder.append_matcher(query.TagsMatcher()) for factory in request.registry.get(FILTERS_KEY, []): builder.append_filter(factory(request)) for factory in request.registry.get(MATCHERS_KEY, []): builder.append_matcher(factory(request)) return builder
def test_multiple_params(self): """Multiple keywords at once are handled correctly.""" anymatcher = query.AnyMatcher() params = multidict.MultiDict() params.add("any", "howdy") params.add("any", "there") result = anymatcher(params) assert result == { "simple_query_string": { "fields": ["quote", "tags", "text", "uri.parts"], "query": "howdy there", } }