<commit_before>module Seek

  module FacetedBrowsing

    def faceted_items
      item_type = params[:item_type]
      item_ids = (params[:item_ids] || []).collect(&:to_i)

      resources = []
      if !item_type.blank?
        clazz = item_type.constantize
        resources = clazz.find_all_by_id(item_ids)
        if clazz.respond_to?(:authorize_asset_collection)
          resources = clazz.authorize_asset_collection(resources,"view")
        else
          resources = resources.select &:can_view?
        end
      end

      resources.sort!{|a,b| item_ids.index(a.id) <=> item_ids.index(b.id)}
      resource_list_items = resources.collect{|resource| render_to_string :partial => "assets/resource_list_item", :object => resource}

      respond_to do |format|
        format.json {render :json => {:resource_list_items => resource_list_items.join(' ')}}
      end
    end

    def ie_support_faceted_browsing?
      @ie_support_faceted_browsing = true
      user_agent = request.env["HTTP_USER_AGENT"]
      index = user_agent.index('MSIE')
      if !index.nil?
        version = user_agent[(index+5)..(index+8)].to_i
        if version != 0 && version < 9
          @ie_support_faceted_browsing = false
        end
      end
      @ie_support_faceted_browsing
    end

  end<commit_msg>fix fail tests<commit_after>module Seek

  module FacetedBrowsing

    def faceted_items
      item_type = params[:item_type]
      item_ids = (params[:item_ids] || []).collect(&:to_i)

      resources = []
      if !item_type.blank?
        clazz = item_type.constantize
        resources = clazz.find_all_by_id(item_ids)
        if clazz.respond_to?(:authorize_asset_collection)
          resources = clazz.authorize_asset_collection(resources,"view")
        else
          resources = resources.select &:can_view?
        end
      end

      resources.sort!{|a,b| item_ids.index(a.id) <=> item_ids.index(b.id)}
      resource_list_items = resources.collect{|resource| render_to_string :partial => "assets/resource_list_item", :object => resource}

      respond_to do |format|
        format.json {render :json => {:resource_list_items => resource_list_items.join(' ')}}
      end
    end

    def ie_support_faceted_browsing?
      @ie_support_faceted_browsing = true
      user_agent = request.env["HTTP_USER_AGENT"]
      index = user_agent.try(:index, 'MSIE')
      if !index.nil?
        version = user_agent[(index+5)..(index+8)].to_i
        if version != 0 && version < 9
          @ie_support_faceted_browsing = false
        end
      end
      @ie_support_faceted_browsing
    end

  end
{'fraction_non_alphanumeric': 0.10927279722970373, 'fraction_numerical': 0.0030781069642170067, 'mean_word_length': 2.8461538461538463, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '788764', 'n_tokens_mistral': 860, 'n_tokens_neox': 831, 'n_words': 146}