     (when-let [[_ match] (match-title products listing')]
       [listing match])))
 
-(defn domatch [products listings]
+(defn domatch
+  "Returns the sequence of Result maps produced by matching the
+  listings to the products."
+  [products listings]
   (let [matches (->> listings
                      (pmap #(match products %))  ; pmap was a 4x speedup
                      (filter some?))]

      (update :model remove-chars)))


(defn longest-starting-match [a b]
  (reduce (fn [match-len [a b]]
            (if (= a b)
              (inc match-len)

  (let [products (mapv prepare-product (load-input (:products-uri conf)))]
    (with-open [listings (io/reader (:listings-uri conf))
                out (io/writer (:out-uri conf))]
      (doseq [item (->> (line-seq listings)
                        (map parse-json)
                        (domatch products))]
        (json/generate-stream item out)
        (.write out "\n")))))
