 (defmethod represent MediaType/TEXT_HTML [docid media-type]
   (StringRepresentation.
    (pages/gen-case-page
-    :citations (let [[incites outcites] (get-cite-documents)]
-                 (prepare-html-document (get-document docid) incites outcites)))
+    :citations (let [[incites outcites] (get-cite-documents docid)]
+                 (prepare-displayed-document (get-displayed-document docid)
+                                             incites outcites)))
    MediaType/TEXT_HTML
    Language/ENGLISH_US
    CharacterSet/UTF_8))

  (doto (SolrQuery. (str "incites:" docid))
    (.setQueryType "standard")
    (.setFields *cite-fields*)
    (.setNumRows 100)))

(defn get-outcites-query [docid]
  (doto (SolrQuery. (str "outcites:" docid))
    (.setQueryType "standard")
    (.setFields *cite-fields*)
    (.setNumRows 100)))

(defn get-displayed-document
  "Searches Solr for the document with the given docid.

   :date (.getFieldValue doc "date")
   :court (.getFieldValue doc "court")
   :citations (.getFieldValues doc "citations")
   :incites (map prepare-cite-document outcite-docs)
   :outcites (map prepare-cite-document incite-docs)})

