module PgSearch::Multisearch

def execute(model, clean_up)

def execute(model, clean_up)
  PgSearch::Document.where(searchable_type: model.base_class.name).delete_all if clean_up
  Rebuilder.new(model).rebuild
end

def rebuild(model, deprecated_clean_up = nil, clean_up: true, transactional: true)

def rebuild(model, deprecated_clean_up = nil, clean_up: true, transactional: true)
  unless deprecated_clean_up.nil?
    ActiveSupport::Deprecation.warn(
      "pg_search 3.0 will no longer accept a boolean second argument to PgSearchMultisearch.rebuild, " \
      "use keyword argument `clean_up:` instead."
    )
    clean_up = deprecated_clean_up
  end
  if transactional
    model.transaction { execute(model, clean_up) }
  else
    execute(model, clean_up)
  end
end