def validate_filters!
      filter_query_params = CGI::parse(env["QUERY_STRING"])['filter']
      valid_filters, invalid_filters = parse_filters(filter_query_params)

      invalid_filters |= incomplete_filters(valid_filters)
      invalid_filters |= invalid_fts_filters(valid_filters)

      return valid_filters if invalid_filters.empty?

      halt(400, { 'Content-Type' => 'application/json' }, render_json({
        :status => 400,
        :msg => "Bad Request",
        :detail =>
          invalid_filters.
          map { |invalid_filter|
            if invalid_filter.is_a?(Hash) && invalid_filter[:error]
              invalid_filter[:error]
            else
              invalid_filter
            end
          }.
          map(&:to_s)
      }))
    end
def validate_filters!
      filter_query_params = CGI::parse(env["QUERY_STRING"])['filter']
      valid_filters, invalid_filters = parse_filters(filter_query_params)

      invalid_filters |= incomplete_filters(valid_filters)
      invalid_filters |= invalid_fts_filters(valid_filters)

      return valid_filters if invalid_filters.empty?

      halt(400, { 'Content-Type' => 'application/json' }, render_json({
        :status => 400,
        :msg => "Bad Request",
        :detail =>
          invalid_filters.
          map { |invalid_filter|
            if invalid_filter.is_a?(Hash) && invalid_filter[:error]
              invalid_filter[:error]
            else
              invalid_filter
            end
          }.
          map(&:to_s)
      }))
    end
Validate the requested filter query strings. If all filters are valid
 then return them as {Hash hashes}, otherwise halt 400 Bad Request and
 return JSON error response.