Construct the filters within the query.
197242
private function constructFilter($source, $query, $date_field, $from, $to) {
        if(is_null($query)) {
            return null;
        }
        if($query[0] !== Token::C_SEARCH && is_null($source)) {
            throw new Exception('No source data for query');
        }

        // There are 2 types of queries. Process each one separately.
        $filters = [];
        switch($query[0]) {
        case Token::C_SEARCH:
            $filters = $query[1];
            break;
        case Token::C_JOIN:
            $filters = $query[3];
            $terms = [];
            foreach($source as $row) {
                $terms[] = [[$row[$query[1]]], true];
            }
            $filter = [Token::X_LIST, $query[2], $terms, false];

            // AND the filter with the rest of the filters (if they exist).
            if(count($filters)) {
                $filters = [Token::F_AND, [$filters, $filter]];
            } else {
                $filters = $filter;
            }
            break;
        default:
            throw new Exception('Unexpected query type');
        }

        // Add time range filter.
        if(!is_null($date_field)) {
            $filter = [Token::F_RANGE, $date_field, true, false, $from, $to];
            if(count($filters)) {
                $filters = [Token::F_AND, [$filters, $filter]];
            } else {
                $filters = $filter;
            }
        }

        return $this->constructFilterRecurse($filters);
    }
269790
def create_filters(predicate_params, predicate_factory):
  
  filters = []
  for predicate_param in predicate_params:
    filters.append(create_filter(predicate_param, predicate_factory))
  return filters
1311155
def apply_filters(query, args):
    
    pre_joins = []
    for querystring_key, filter_value in args.items(multi=True):
        if querystring_key in filter_registry:
            cls_inst = filter_registry[querystring_key]
            query = cls_inst.apply_filter(query, args, pre_joins)
        elif querystring_key in PaginationKeys._value_list:
            pass
        else:
            raise InvalidQueryString(querystring_key, filter_value)
    return query
56539
def filter(self):
        
        if isinstance(self._filter, str):
            return self._decode_query(self._filter)
        return self._filter
582631
public function buildFilters()
    {
        $this->addFilter('title', new StringFilterType('title'), 'Title');
        $this->addFilter('online', new BooleanFilterType('online', 't'), 'Online');
        $this->addFilter('updated', new DateTimeFilterType('updated', 'v'), 'Updated at');
    }
1211102
def map_query_filters(filters)
      Hash[filters.map do |key, value|
        case value
        when Hash then
          if value.key? :any then format_query_filter('$in', key, value[:any])
          elsif value.key? :all then format_query_filter('$all', key, value[:all])
          else raise UnknownFilterQueryOperator, value.keys.join(','), caller end
        else format_query_filter('$all', key, value)
        end
      end]
    end
264098
def filters(self):
        
        results = []
        filters = self.qs.get('filter')
        if filters is not None:
            try:
                results.extend(json.loads(filters))
            except (ValueError, TypeError):
                raise InvalidFilters("Parse error")
        if self._get_key_values('filter['):
            results.extend(self._simple_filters(self._get_key_values('filter[')))
        return results
994339
public function buildFilters()
    {
        $this->addFilter('title', new StringFilterType('title'), 'article.page.list.filter.title')
            ->addFilter('online', new BooleanFilterType('online'), 'article.page.list.filter.online')
            ->addFilter('created', new DateFilterType('created', 'nv'), 'article.page.list.filter.created_at')
            ->addFilter('updated', new DateFilterType('updated', 'nv'), 'article.page.list.filter.updated_at');
    }
461661
function buildFilters(filters) {
    var builtFilters = [];
    filters.forEach(function(filter) {
      builtFilters.push(MongoDatabase.buildFilter(filter));
    });
    return builtFilters;
  }
916115
def add_key_filters(self, key_filters):
        
        if self._input_mode == 'query':
            raise ValueError('Key filters are not supported in a query.')

        self._key_filters.extend(key_filters)
        return self
356302
def _build_query(self):
        
        if isinstance(self._query_string, QueryString):
            self._query_dsl = self._query_string
        elif isinstance(self._query_string, string_types):
            self._query_dsl = QueryString(self._query_string)
        else:
            self._query_dsl = MatchAll()
1292623
public function buildFilters()
    {
	$this->addFilter('type', new ORM\EnumerationFilterType('type'), 'Type', array_combine(Bike::$types, Bike::$types));
	$this->addFilter('brand', new ORM\StringFilterType('brand'), 'Brand');
	$this->addFilter('model', new ORM\StringFilterType('model'), 'Model');
	$this->addFilter('price', new ORM\NumberFilterType('price'), 'Price');
    }
71438
def filters(self):
        """"""
        if self._filters is None:
            self._filters, self._attributes = self._fetch_configuration()
        return self._filters
965617
def build_search(self):
        
        s = self.search()
        s = self.query(s, self._query)
        s = self.filter(s)
        if self.fields:
            s = self.highlight(s)
        s = self.sort(s)
        self.aggregate(s)
        return s
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}
1065712
def _add_filters(self, **filters):
        """"""
        for key, value in filters.items():
            if self._field_is_pk(key):
                pk = self.cls.get_field('pk').normalize(value)
                self._lazy_collection['pks'].add(pk)
            else:
                # store the info to call the index later, in ``_prepare_sets``
                # (to avoid doing extra work if the collection is never called)
                index, suffix, extra_field_parts = self._parse_filter_key(key)
                parsed_filter = ParsedFilter(index, suffix, extra_field_parts, value)
                self._lazy_collection['sets'].append(parsed_filter)

        return self
851894
public function buildFilters()
    {
        $builder = $this->getFilterBuilder();
        $builder->add('created', new DateFilterType('created'), 'Date')
                ->add('lang', new StringFilterType('lang'), 'Language')
                ->add('ipAddress', new StringFilterType('ipAddress'), 'IP Address');
    }