class Ransack::Search

def initialize(object, params = {}, options = {})

def initialize(object, params = {}, options = {})
  strip_whitespace = options.fetch(:strip_whitespace, Ransack.options[:strip_whitespace])
  # Strong parameters carry whether the controller permitted them. Read
  # that before the unwrap below discards it: a model with no allowlist
  # of its own lets a permitted controller be the boundary, and a plain
  # Hash never counts (#1403).
  permitted = params.respond_to?(:permitted?) && params.permitted?
  params = params.to_unsafe_h if params.respond_to?(:to_unsafe_h)
  if params.is_a? Hash
    # deep_transform_values rebuilds every nested hash and array, which
    # also gives the pruning below a private copy to edit — the caller's
    # params come back untouched. Values nested inside `g:` groupings and
    # `c:` conditions are stripped too, not just the top level.
    params = params.deep_transform_values { |v| v.is_a?(String) && strip_whitespace ? v.strip : v }
    params.delete_if { |_k, v| blank_condition_value?(v) }
    prune_blank_advanced_conditions!(params)
  else
    params = {}
  end
  @context = options[:context] || Context.for(object, options)
  @context.auth_object = options[:auth_object]
  @context.permitted = permitted
  @context.ignore_unknown_conditions = options[:ignore_unknown_conditions]
  @context.null_sentinel = options[:null_sentinel]
  @base = Nodes::Grouping.new(
    @context, options[:grouping] || Constants::AND
    )
  @scope_args = {}
  @sorts ||= []
  @ignore_unknown_conditions = options[:ignore_unknown_conditions] == false ? false : true
  build(params.with_indifferent_access)
end