 
 (defn to-term-seq [^String words]
   (if words
-    (filter not-too-short? (re-seq re-term (.toLowerCase (strip-html words))))
+    (filter valid-term? (re-seq re-term (.toLowerCase (strip-html words))))
     []))
 
 (defn to-term-list [exercise] 

          
(def inverted-index (ref {}))

(defn insert-term [assoc-fn ex-id index term]
  (if-let [postings (index term)]
    (let [new-val (conj postings ex-id)]

  (:require [monger.collection :as mc]
            [monger.query :as mq]
            [clj-time.core :as time]
            [clj-time.coerce :as cljc]
            [monger.result :as mr]
            [clojure.string :as string])
  (:import [org.bson.types ObjectId]))

(def #^{:private true} logger (org.slf4j.LoggerFactory/getLogger (str *ns*)))

(def min-term-length 2)
(def max-term-length 15)

(def search-per-page 20)

(def common-word #{"ja" "ei"})

(defn valid-term? [term] 
  (and (>= (count term) min-term-length) 
       (<= (count term) max-term-length)
       (not (common-word term))))

(defn tags-to-string [tags]
  (apply str (interpose " " tags)))
