<commit_before>class Admin::ProductsController <  Admin::BaseController
  
  def index

    @manufacturers_array = Rails.cache.read("all_manufacturers")
    if @manufacturers_array.nil?
      @manufacturers_array = Product.group("manufacturer").collect(&:manufacturer).compact.sort
      Rails.cache.write("all_manufacturers", @manufacturers_array)
    end
    
     # Resource was accessed in nested form through /admin/categories/n/products
    if params[:category_id]
      @category = Category.find params[:category_id]
      # Which categories to display on top of the product list for deeper
      # navigation into the category tree.
      @categories = @category.children
      @products = @category.products.paginate(:per_page => Product.per_page, :page => params[:page])

    else
      @categories ||= Category.roots

      keyword = nil
      keyword = params[:search][:keyword] unless params[:search].blank? or params[:search][:keyword].blank?
      conditions = {}
      conditions[:manufacturer] = params[:manufacturer] unless params[:manufacturer].blank?

      @products =       Product.search(keyword,
                                      :conditions => conditions,
                                      :max_matches => 10000,
                                      :per_page => Product.per_page,
                                      :page => params[:page])
    end
    
  end
  
  def create
    @product = Product.create(params[:product])
    if @product.save
      flash[:notice] = "Product created."
      redirect_to edit_admin_product_path(@product)
    else
      flash[:error] = "Error creating product."
      render :action => 'new', :layout => 'admin_blank'
    end
  end
  
  def new
    @product = Product.new
    # Must add this, otherwise the product picture partial in 
    # views/admin/products/new.html.erb fails
    #@product.product_pictures << ProductPicture.new
    render :layout => 'admin_blank'
  end
  
  def edit
    @product = Product.find(params[:id])
    render :layout => 'admin_blank'
  end
  <commit_msg>Max matches upped to 100000<commit_after>class Admin::ProductsController <  Admin::BaseController
  
  def index

    @manufacturers_array = Rails.cache.read("all_manufacturers")
    if @manufacturers_array.nil?
      @manufacturers_array = Product.group("manufacturer").collect(&:manufacturer).compact.sort
      Rails.cache.write("all_manufacturers", @manufacturers_array)
    end
    
     # Resource was accessed in nested form through /admin/categories/n/products
    if params[:category_id]
      @category = Category.find params[:category_id]
      # Which categories to display on top of the product list for deeper
      # navigation into the category tree.
      @categories = @category.children
      @products = @category.products.paginate(:per_page => Product.per_page, :page => params[:page])

    else
      @categories ||= Category.roots

      keyword = nil
      keyword = params[:search][:keyword] unless params[:search].blank? or params[:search][:keyword].blank?
      conditions = {}
      conditions[:manufacturer] = params[:manufacturer] unless params[:manufacturer].blank?

      @products =       Product.search(keyword,
                                      :conditions => conditions,
                                      :max_matches => 100000,
                                      :per_page => Product.per_page,
                                      :page => params[:page])
    end
    
  end
  
  def create
    @product = Product.create(params[:product])
    if @product.save
      flash[:notice] = "Product created."
      redirect_to edit_admin_product_path(@product)
    else
      flash[:error] = "Error creating product."
      render :action => 'new', :layout => 'admin_blank'
    end
  end
  
  def new
    @product = Product.new
    # Must add this, otherwise the product picture partial in 
    # views/admin/products/new.html.erb fails
    #@product.product_pictures << ProductPicture.new
    render :layout => 'admin_blank'
  end
  
  def edit
    @product = Product.find(params[:id])
    render :layout => 'admin_blank'
  end
  
{'fraction_non_alphanumeric': 0.1060789537418261, 'fraction_numerical': 0.004117219665778639, 'mean_word_length': 2.532934131736527, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4616592', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1081, 'n_words': 266}