       (NumericRangeQuery/newLongRange field-name min max true true))))
 
 (defn #^QueryWrapperFilter create-filter [filters]
-  "Creates a filter for the category, which is wrapped in double quotes."
+  "Creates a Lucene BooleanQuery wrapped in a QueryWrapperFilter with one
+   or more filter queries (if zero this function returns nil).
+
+   The following filters are possible:
+   :published-between {:min rfc3339-date-string :max rfc-3339-date-string}
+   :updated-between {:min rfc3339-date-string :max rfc-3339-date-string}
+   :language String (literal)
+   :feed String (literal)
+   :slug String (literal)
+   :draft Boolean
+
+   See the unit tests for examples."
   (let [{:keys [published-between
                 updated-between
                 language

(def index-path "/var/lucene/vix")

(defn #^StandardAnalyzer create-analyzer []
  (StandardAnalyzer. (. Version LUCENE_35)))

(defn create-directory [path]
  (if (= path :RAM)
    (RAMDirectory.)
    (NIOFSDirectory. (File. path))))

    (close-index-writer writer)))

(defmethod add-documents-to-index! [IndexWriter Object] [writer documents]
  "Adds the documents to the provided IndexWriter, but doesn't close it
   (i.e. the IndexWriter needs to be closed externally to write the
   changes to disk or memory)."
  (doseq [document documents]
    (.addDocument writer (create-document document))))

(defn delete-document-from-index! [directory slug]
  "Deletes the document with the provided slug from the provided Lucene
   Directory object."
  (doto (create-index-writer (create-analyzer) directory :append)
    (.deleteDocuments (Term. "slug" slug))
    (.close)))

(defn update-document-in-index! [directory slug document]
  "Deletes the existing document with the provided slug from the
   provided Lucene Directory object and creates a new document using
   the provided document map."
  (let [analyzer (create-analyzer)]
    (doto (create-index-writer analyzer directory :append)
      (.updateDocument (Term. "slug" slug)
