<commit_before>module CatalogHelper

  protected

  include DisplayHelper
  include ManageProductsHelper

  def load_query_and_scope
    @base_query = params[:base_query].to_s
    @query = params[:query].to_s
    @final_query = if @base_query.empty?
                     @query
                   elsif @query.blank?
                     @base_query
                   else
                     "(#{@base_query}) AND #{@query}"
                   end

    @scope = params[:scope].to_s
    if @scope == 'all'
      @context = environment
      @ar_scope = environment.products.enabled.public
    else
      @context = profile
      @ar_scope = profile.products
    end
  end

  def catalog_load_index options = {}
    options ||= {}
    options[:page] ||= params[:page]

    @catalog_bar = true
    @use_show_more = params[:use_show_more] == '1' if @use_show_more.nil?

    load_query_and_scope
    solr_options = {:all_facets => @query.blank?}

    base_per_page = profile.products_per_catalog_page rescue 24

    @rank = params[:rank].to_i<commit_msg>catalog: only search unarchived<commit_after>module CatalogHelper

  protected

  include DisplayHelper
  include ManageProductsHelper

  def load_query_and_scope
    @base_query = params[:base_query].to_s
    @query = params[:query].to_s
    @final_query = if @base_query.empty?
                     @query
                   elsif @query.blank?
                     @base_query
                   else
                     "(#{@base_query}) AND #{@query}"
                   end

    @scope = params[:scope].to_s
    if @scope == 'all'
      @context = environment
      @ar_scope = environment.products.enabled.public.unarchived
    else
      @context = profile
      @ar_scope = profile.products.unarchived
    end
  end

  def catalog_load_index options = {}
    options ||= {}
    options[:page] ||= params[:page]

    @catalog_bar = true
    @use_show_more = params[:use_show_more] == '1' if @use_show_more.nil?

    load_query_and_scope
    solr_options = {:all_facets => @query.blank?}

    base_per_page = profile.products_per_catalog_page rescue 24

    @rank = params[:rank].to_i
{'fraction_non_alphanumeric': 0.1021455223880597, 'fraction_numerical': 0.002798507462686567, 'mean_word_length': 2.3, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6619202', 'n_tokens_mistral': 677, 'n_tokens_neox': 638, 'n_words': 130}