     (Files/probeContentType path)))
 
 (defn assign-body-and-image
-  [base-doc doc-path mime-type]
-  (let [doc-content (slurp doc-path)]
+  [base-doc doc-file mime-type]
+  (log/debug base-doc)
+  (let [doc-content (slurp doc-file)]
     (if (re-find is-img-regex mime-type)
       (assoc base-doc :body :image :image (.getBytes doc-content))
       (assoc base-doc :body doc-content :image nil))))

  update's `where' clause.

  Also note: there are two kinds of files to be loaded: text and images (binary)."
  [tentacle src-dir]
  (let [relpath-file-pairs (f/list-files-with-relative-paths src-dir)
        tent-name (:name tentacle)]
    (doseq [[relpath doc-file] relpath-file-pairs
            :let [doc-mime-type (get-mime-type doc-file)
                  base-doc {:name (str tent-name "-" (.getName doc-file))
                            ;; :path doc-file
                            :mime-type doc-mime-type
                            :uri (str tent-name "/" relpath)
                            :tentacle-name tent-name}
                  new-doc (assign-body-and-image base-doc doc-file doc-mime-type)]]
      (db/save-document! new-doc false))
    (db/update-document-index)))

(defn load-fn
  [uri]
  (db/get-document-by-uri uri))

(defn remove-fn
  [document]

(ns doctopus.storage.impls.postgres-impl
  (:require [doctopus.configuration :as configuration]
            [doctopus.db :as db]
            [doctopus.files :as f]
            [ring.util.mime-type :as ring-mime]
            [ring.util.response :as response]
            [taoensso.timbre :as log])
  (:import [java.io ByteArrayInputStream]
           [java.nio.file Files Paths]))

(def is-img-regex #"^image")

(defn count-fn [tentacle]
  (count (db/get-all-documents-for-tentacle tentacle)))

(defn get-mime-type
  [f]
