 
 (defn- fdocs [^IndexSearcher searcher ^Query query opts]
   (.search searcher query nil
-           (int (* (:page opts) (hits-per-page))) (get-sort opts)))
+           (* (:page opts) (hits-per-page)) (get-sort opts)))
 
 (defn- total-page [^TopFieldDocs fdocs]
   (let [total-hits (.totalHits fdocs)]

  (when-not (:quiet opts)
    (println (format "clj-opengrok> %s/%s" (:page opts) (:total-page opts)))))

(defn- documents [^IndexSearcher searcher ^TopFieldDocs fdocs opts]
  (let [hpp (hits-per-page)
        n (* (dec (:page opts)) hpp)]
    (page-info opts)
    (map #(.doc searcher (.doc ^ScoreDoc %))
         (take hpp (drop n (.scoreDocs fdocs))))))

(defn- print-hit [^Hit hit]
  (let [file (.getAbsolutePath (File. (get-root-path) (.getPath hit)))
        line-num (.getLineno hit)
        line (.getLine hit)]
    (println (str file ":" line-num ": "

      (when (= "p" (.get doc "t"))
        (.getContext scontext
                     (InputStreamReader.
                      (FileInputStream. (str (root-path) file)))
                     nil nil nil file nil false false hit))

      (not (.isEmpty hcontext))
      (.getContext hcontext
                   (str (root-path) file) file hit)

      :else
      (.add hit (Hit. file "..." "1" false true)))
