   "Contains functions for parsing and converting query parameters to query conditions"
   (:require
    [clojure.set :as set]
-   [clojure.string :as str]
+   [clojure.string :as string]
    [cmr.common-app.services.search.group-query-conditions :as gc]
    [cmr.common-app.services.search.parameters.converters.nested-field :as nf]
    [cmr.common-app.services.search.params :as common-params]

       (map #(common-params/parameter->condition context concept-type param % options) value))
      (gc/or-conds
       (map #(common-params/parameter->condition context concept-type param % options) value)))
    (let [[start-date end-date] (map str/trim (str/split value #","))]
      (cqm/map->DateRangeCondition
       {:field param
        :start-date (when-not (str/blank? start-date) (parser/parse-datetime start-date))
        :end-date (when-not (str/blank? end-date) (parser/parse-datetime end-date))}))))

(defmethod common-params/parameter->condition :readable-granule-name
  [context concept-type param value options]

  (let [case-sensitive? (common-params/case-sensitive-field? concept-type param options)
        pattern? (common-params/pattern-field? concept-type param options)
        group-operation (common-params/group-operation param options :and)
        target-field (keyword (string/replace (name param) #"-h$" ""))]

    (if (map? (first (vals value)))
      ;; If multiple variables are passed in like the following
