<commit_before>module SpreeImporter
  module Exporters
    class Product
      include SpreeImporter::Exporters::Base
      include SpreeImporter::Exporters::Target

      default_exporters :product, :option, :property, :taxonomy

      # static
      def headers(product_or_variant)
        ['sku pattern', 'sku', 'name', 'price', 'available on', 'description', 'meta description', 'meta keywords', 'cost price']
      end

      def append(row, product)
        headers(product).each do |h|
          m = header_to_method(h)
          
          next unless product.respond_to? m

          if date_column? m
            row[h] = product.send(m).try :strftime, SpreeImporter.config.date_format
          else
            row[h] = product.send m
          end
        end
      end

      def date_column?(column)
        SpreeImporter.config.date_columns.include? column
      end

      def each_export_item(search, &block)
        case search
        when :all, nil
          Spree::Product.find_each &block
        when :dummy
          block.call SpreeImporter::DummyProduct.new
        else
          Spree::Product.ransack(search).result.group_by_products_id.find_each &block
        end
      end
<commit_msg>removed group by in exporter ransack search test<commit_after>module SpreeImporter
  module Exporters
    class Product
      include SpreeImporter::Exporters::Base
      include SpreeImporter::Exporters::Target

      default_exporters :product, :option, :property, :taxonomy

      # static
      def headers(product_or_variant)
        ['sku pattern', 'sku', 'name', 'price', 'available on', 'description', 'meta description', 'meta keywords', 'cost price']
      end

      def append(row, product)
        headers(product).each do |h|
          m = header_to_method(h)
          
          next unless product.respond_to? m

          if date_column? m
            row[h] = product.send(m).try :strftime, SpreeImporter.config.date_format
          else
            row[h] = product.send m
          end
        end
      end

      def date_column?(column)
        SpreeImporter.config.date_columns.include? column
      end

      def each_export_item(search, &block)
        case search
        when :all, nil
          Spree::Product.find_each &block
        when :dummy
          block.call SpreeImporter::DummyProduct.new
        else
          Spree::Product.ransack(search).result.find_each &block
        end
      end

{'fraction_non_alphanumeric': 0.08857142857142856, 'fraction_numerical': 0.0, 'mean_word_length': 2.23778071334214, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2219763', 'n_tokens_mistral': 715, 'n_tokens_neox': 693, 'n_words': 173}