Sha256: d0afada77b2c2ce6114416456567c708cabb4e0a82d3159b16b9ac6acdc2b95b

Contents?: true

Size: 531 Bytes

Versions: 5

Compression:

Stored size: 531 Bytes

Contents

module Workarea
  decorate IndexProduct, with: :browse_option do
    class_methods do
      def perform(product)
        clear(product)
        super
      end

      def clear(product)
        id = Search::Storefront::Product.new(product).keywords[:catalog_id]
        id.gsub!(Workarea.config.search_index_id_escape_regex) { |match| "\\#{match}" }
        hits = Search::Storefront.search("keywords.catalog_id:#{id}")['hits']['hits']

        hits.each { |hit| Search::Storefront.delete(hit['_id']) }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workarea-browse_option-2.2.0 app/workers/workarea/index_product.decorator
workarea-browse_option-2.1.9 app/workers/workarea/index_product.decorator
workarea-browse_option-2.1.8 app/workers/workarea/index_product.decorator
workarea-browse_option-2.1.7 app/workers/workarea/index_product.decorator
workarea-browse_option-2.1.6 app/workers/workarea/index_product.decorator