<commit_before>class UsersController < CoffeeGraderApiController
  before_action :authenticate_user!
  before_action :find_user, only: [:show]
  # GET /users/id
  def show
    json_response(@user)
  end

  # GET /users/search
  def search
    @results =
      if params[:term]
        users_search.call(params[:term], pagination_options)
      else
        []
      end
    json_response(@results)
  end

  private

  def find_user
    @user = User.find(params[:id])
  end

  def users_search
    Search.new('users', %w(username email))
  end
end
<commit_msg>Minor refactor of results instance variable assignment in UsersController#search<commit_after>class UsersController < CoffeeGraderApiController
  before_action :authenticate_user!
  before_action :find_user, only: [:show]
  # GET /users/id
  def show
    json_response(@user)
  end

  # GET /users/search
  def search
    @results =
      params[:term] ? users_search.call(params[:term], pagination_options) : []
    json_response(@results)
  end

  private

  def find_user
    @user = User.find(params[:id])
  end

  def users_search
    Search.new('users', %w(username email))
  end
end

{'fraction_non_alphanumeric': 0.09834638816362054, 'fraction_numerical': 0.0, 'mean_word_length': 3.4921875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2745493', 'n_tokens_mistral': 373, 'n_tokens_neox': 362, 'n_words': 87}