Sha256: 977642b21cc937eae1ef06621059b08044d77c04c02e2831f9bf4e4dbe53c321

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

module Jamnagar
  module Refiners
    class DuplicateDetection < Refiner
      def initialize(detector=nil, store: nil)
        @detector = detector || Utilities::DuplicateDetector.new(store)
      end

      def to_s
        "Duplicate Detection"
      end

      def refine(item)
        super item
      end

      def refinement_result(item)
        result = @detector.detect(item["final_url"])
        return {"duplicate" => false} unless result
        {"duplicate" => true, "duplicate_of" => result["_id"]}
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jamnagar-1.3.9.1 lib/jamnagar/refiners/duplicate_detection.rb
jamnagar-1.3.9 lib/jamnagar/refiners/duplicate_detection.rb
jamnagar-1.3.8 lib/jamnagar/refiners/duplicate_detection.rb