Add a filter to this query.
        Appends to any previous filters set.

        :rtype: Query
779312
def filter(self, **filters):
        

        q = self._clone()
        for key, value in filters.items():
            filter_key = re.split('__', key)
            filter_attr = filter_key[0]
            if filter_attr not in self._valid_filter_attrs:
                raise ClientValidationError("Invalid filter attribute: %s" % key)

            # we use __ as a separator in the Python library, the APIs use '.'
            q._filters['.'.join(filter_key)].append(value)
        return q
1319283
def push_filters(self, new_filters):
        
        t = self.tokenizer
        for f in new_filters:
            t = f(t)
        self.tokenizer = t
972146
def _get_query(self, order=None, filters=None):
        
        order = self._get_order(order)
        return self.posts.all().order_by(order)
383230
def filter(self, **kwargs):
        
        if kwargs:
            assert self.query.can_filter(), "Cannot filter a query once a slice has been taken."

        clone = self._clone()
        clone.query.add_filters(**kwargs)

        return clone
535320
def __filter_query(self) -> str:
        
        filter_query = 'WHERE %s'
        bind_values = {}
        if not self.__filters:
            return None
        for filter in self.__filters:
            bind = {
                'name': Security.random_string(5),
                'value': filter['value']}
            filter_str = '%s %s :%s' % \
                (filter['column'], filter['operator'], bind['name'])
            bind_values[bind['name']] = bind['value']
            filter_query = filter_query % (filter_str + ' AND %s')
        return {
            'query': filter_query.replace(' AND %s', ''),
            'binds': bind_values}
1200004
def build_filters(self, view, filters=None):
        
        query_builder = self.get_query_builder(backend=self, view=view)
        return query_builder.build_query(**(filters if filters else {}))
98846
def _query(self, request, filter=None):
        
        limit = None
        offset = None
        if 'maxfeatures' in request.params:
            limit = int(request.params['maxfeatures'])
        if 'limit' in request.params:
            limit = int(request.params['limit'])
        if 'offset' in request.params:
            offset = int(request.params['offset'])
        if filter is None:
            filter = create_filter(request, self.mapped_class, self.geom_attr)
        query = self.Session().query(self.mapped_class)
        if filter is not None:
            query = query.filter(filter)
        order_by = self._get_order_by(request)
        if order_by is not None:
            query = query.order_by(order_by)
        query = query.limit(limit).offset(offset)
        return query.all()
60345
def filter_queryset(self, queryset):
        
        for name, filt in self.filters.items():
            val = self.values.get(name, None)
            if name is None:
                continue
            params = filt.filter_params(val)
            if not params:
                continue
            if isinstance(params, dict):
                queryset = queryset.filter(**params)
            if isinstance(params, QNode):
                queryset = queryset.filter(params)
        return queryset
1680
def filter_by(self, **kwargs):
        
        query = self._copy()
        for field, value in kwargs.items():
            query.domain.append(
                (field, '=', value)
            )
        return query
1088743
def apply_filters(self, queryset, applicable_filters=None, applicable_exclusions=None):
        
        for field, options in applicable_filters["field_facets"].items():
            queryset = queryset.facet(field, **options)

        for field, options in applicable_filters["date_facets"].items():
            queryset = queryset.date_facet(field, **options)

        for field, options in applicable_filters["query_facets"].items():
            queryset = queryset.query_facet(field, **options)

        return queryset
557494
def filter(cls, filters, iterable):
    ''''''
    if isinstance(filters, Filter):
      filters = [filters]

    for filter in filters:
      iterable = filter.generator(iterable)

    return iterable
678123
def rest_add_filters(self, data):
        
        for _filter in data:
            filter_class = map_args_filter.get(_filter["opr"], None)
            if filter_class:
                self.add_filter(_filter["col"], filter_class, _filter["value"])
56539
def filter(self):
        
        if isinstance(self._filter, str):
            return self._decode_query(self._filter)
        return self._filter
619019
def add_filter(filter, filter_options = {})
      filter = RequestLogAnalyzer::Filter.const_get(RequestLogAnalyzer.to_camelcase(filter)) if filter.is_a?(Symbol)
      @filters << filter.new(source.file_format, @options.merge(filter_options))
    end
579535
def addQuery( self ):
        
        insert_item = self.uiQueryTREE.currentItem()
        if ( insert_item and not insert_item.isSelected() ):
            insert_item = None
        
        # create the query
        if ( self.uiQueryTXT.text() ):
            query = Q.fromString(nativestring(self.uiQueryTXT.text()))
            self.uiQueryTXT.setText('')
        else:
            query = Q()
        
        # determine where to create the item at
        tree = self.uiQueryTREE
        
        if ( not insert_item ):
            # determine if we are already joining queries together
            count = tree.topLevelItemCount()
            
            # create the first item
            if ( not count ):
                XQueryItem(tree, query)
            else:
                if ( 1 < count ):
                    join = tree.topLevelItem(count - 2).text(0)
                else:
                    join = 'and'
                
                # create the join item & query item
                XJoinItem(tree, join)
                XQueryItem(tree, query)
        
        # add a query into a group
        elif ( insert_item.childCount() ):
            count = insert_item.childCount()
            join = insert_item.child(count - 2).text(0)
            
            # add the query to the group
            XJoinItem(insert_item, join)
            XQueryItem(tree, query)
        
        # add a query underneath another item
        else:
            parent_item = insert_item.parent()
            
            # add into the tree
            if ( not parent_item ):
                count = tree.topLevelItemCount()
                index = tree.indexOfTopLevelItem(insert_item)
                
                # add to the end
                if ( index == count - 1 ):
                    if ( 1 < count ):
                        join = tree.topLevelItem(count - 2).text(0)
                    else:
                        join = 'and'
                    
                    XJoinItem(tree, join)
                    XQueryItem(tree, query)
                
                # insert in the middle
                else:
                    join_item = tree.topLevelItem(index + 1)
                    join = join_item.text(0)
                    XJoinItem(tree, join, preceeding = join_item)
                    XQueryItem(tree, query, preceeding = join_item)
            else:
                count = parent_item.childCount()
                index = parent_item.indexOfChild(insert_item)
                
                # add to the end
                if ( index == count - 1 ):
                    if ( 1 < count ):
                        join = parent_item.child(count - 2).text(0)
                    else:
                        join = 'and'
                    
                    XJoinItem(parent_item, join)
                    XQueryItem(parent_item, query)
                
                # insert in the middle
                else:
                    join_item = parent_item.child(index + 1)
                    join = join_item.text(0)
                    XJoinItem(parent_item, join, preceeding = join_item)
                    XQueryItem(parent_item, join, preceeding = join_item)
628815
def add_filter(self, filter_values):
        """"""
        field = self._params['field']
        # Build a `AND` query on values wihtout the OR operator.
        # and a `OR` query for each value containing the OR operator.
        filters = [
            Q('bool', should=[
                Q('term',  **{field: v}) for v in value.split(OR_SEPARATOR)
            ])
            if OR_SEPARATOR in value else
            Q('term',  **{field: value})
            for value in filter_values
        ]
        return Q('bool', must=filters) if len(filters) > 1 else filters[0]
943531
def set_filters(self, filters):
        
        if filters == None or isinstance(filters, (tuple, list)):
            self.filters = filters
        else:
            self.filters = [ filters ]