<commit_before>class NanoApi::Backends::SearchesController < NanoApi::ApplicationController

  def new
    @search = search_instance search_params
  end

  def show
    @search = NanoApi::Search.find(params[:id])
    render :new
  end

  def create
    @search = NanoApi::Search.new(search_params)
    cookies[:search_params] = {
      :value => @search.search_params.to_json,
      :domain => (request.domain if request.domain.include?('.'))
    }

    search_result = @search.search
    increase_referer_search_count!

    if search_result.present?
      forward_json(*search_result)
    else
      render json: {}, status: :internal_server_error
    end
  end

private

  def search_params<commit_msg>A little bugfix.<commit_after>class NanoApi::Backends::SearchesController < NanoApi::ApplicationController

  def new
    @search = search_instance search_params
  end

  def show
    @search = NanoApi::Search.find(params[:id])
    render :new
  end

  def create
    @search = NanoApi::Search.new(search_params)
    cookies[:search_params] = {
      :value => @search.search_params.to_json,
      :domain => (request.domain unless request.local?)
    }

    search_result = @search.search
    increase_referer_search_count!

    if search_result.present?
      forward_json(*search_result)
    else
      render json: {}, status: :internal_server_error
    end
  end

private

  def search_params
{'fraction_non_alphanumeric': 0.099214846538187, 'fraction_numerical': 0.0, 'mean_word_length': 3.581699346405229, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2365759', 'n_tokens_mistral': 441, 'n_tokens_neox': 426, 'n_words': 87}