Exemple #1
0
 def __init__(
     self,
     request,
     separate_replies=False,
     separate_wildcard_uri_keys=True,
     _replies_limit=200,
 ):
     self.es = request.es
     self.separate_replies = separate_replies
     self._replies_limit = _replies_limit
     # Order matters! The KeyValueMatcher must be run last,
     # after all other modifiers have popped off the params.
     self._modifiers = [
         query.Sorter(),
         query.Limiter(),
         query.DeletedFilter(),
         query.AuthFilter(request),
         query.GroupFilter(),
         query.GroupAuthFilter(request),
         query.UserFilter(),
         query.HiddenFilter(request),
         query.AnyMatcher(),
         query.TagsMatcher(),
         query.UriCombinedWildcardFilter(
             request, separate_keys=separate_wildcard_uri_keys
         ),
         query.KeyValueMatcher(),
     ]
     self._aggregations = []
Exemple #2
0
    def test_strips_param(self):
        groupfilter = query.GroupFilter()
        params = {"group": "wibble"}

        groupfilter(params)

        assert params == {}
Exemple #3
0
Fichier : core.py Projet : kael/h
 def __init__(self,
              request,
              separate_replies=False,
              stats=None,
              _replies_limit=200):
     self.es = request.es
     self.separate_replies = separate_replies
     self.stats = stats
     self._replies_limit = _replies_limit
     # Order matters! The KeyValueMatcher must be run last,
     # after all other modifiers have popped off the params.
     self._modifiers = [
         query.Sorter(),
         query.Limiter(),
         query.DeletedFilter(),
         query.AuthFilter(request),
         query.GroupFilter(),
         query.GroupAuthFilter(request),
         query.UserFilter(),
         query.NipsaFilter(request),
         query.AnyMatcher(),
         query.TagsMatcher(),
         query.KeyValueMatcher()
     ]
     self._aggregations = []
Exemple #4
0
    def test_term_filters_for_group(self):
        groupfilter = query.GroupFilter()

        assert groupfilter({"group": "wibble"}) == {
            "term": {
                "group": "wibble"
            }
        }
Exemple #5
0
 def _default_querybuilder(request, es):
     builder = query.Builder(es_version=es.version)
     builder.append_filter(query.DeletedFilter())
     builder.append_filter(query.AuthFilter(request))
     builder.append_filter(query.UriFilter(request))
     builder.append_filter(query.GroupFilter())
     builder.append_filter(query.GroupAuthFilter(request))
     builder.append_filter(query.UserFilter())
     builder.append_filter(query.NipsaFilter(request))
     builder.append_matcher(query.AnyMatcher())
     builder.append_matcher(query.TagsMatcher())
     return builder
Exemple #6
0
def default_querybuilder(request):
    builder = query.Builder()
    builder.append_filter(query.DeletedFilter())
    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))
    return builder
Exemple #7
0
 def search(self, pyramid_request, search):
     search.append_modifier(query.GroupFilter(pyramid_request))
     return search
Exemple #8
0
 def search(self, search):
     search.append_modifier(query.GroupFilter())
     return search
Exemple #9
0
    def test_returns_none_when_no_param(self):
        groupfilter = query.GroupFilter()

        assert groupfilter({}) is None