lib/eco/api/microcases/strict_search.rb in eco-helpers-1.5.1 vs lib/eco/api/microcases/strict_search.rb in eco-helpers-1.5.2

- old
+ new

@@ -1,14 +1,19 @@ module Eco module API class MicroCases - #self.define("strict_search") do |session, options| - - # @param options [Hash] the options - def strict_search(options) - strict_config = session.config.people.strict_search? - strict_option = !options[:search]&.key?(:strict) || options.dig(:search, :strict) - strict_config && strict_option + # When trying to find an `person` with given a source `entry`, it states if such a search should be `strict` or `soft`. + # @note + # - `strict` searches ignore the email when the source `entry` has an `external_id` specified. + # - see related command line options `-search-strict` and `-search-soft` + # @param options [Hash] the options. + # @return [Boolean] `true` if the search should be `strict` only, and `false` otherwise. + def strict_search?(options) + strict_config = session.config.people.strict_search? + strict_option = options.dig(:search, :strict) + soft_option = options.dig(:search, :soft) && !strict_option + (strict_config || strict_option) && !soft_option end + end end end