public function getFilterQuery(array $default = array(), $allowed = array())
    {
        $query = $this->query;
        foreach ($query as $key => $value) {

            if (!is_string($value)) {
                continue;
            }

            if ($key === 'sort' && strpos($value, '-') !== false) {
                list($sort, $order) = explode('-', $value, 2);
                $query['sort'] = $sort;
                $query['order'] = $order;
            }

            if ($value === 'any') {
                unset($query[$key]);
            }
        }

        $query += $default;

        if (empty($allowed)) {
            return $query;
        }

        return array_intersect_key($query, array_flip($allowed));
    }