tons of bug fixes
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
[clojure.string :as str]))
|
||||
|
||||
(defn get-valid-matches [matches not-found-description not-found-value text]
|
||||
(let [valid-matches (take 5 (for [[[id t :as match] i] (map vector matches (range))
|
||||
(let [valid-matches (take 15 (for [[[id t :as match] i] (map vector matches (range))
|
||||
:when (str/includes? (or (some-> t .toLowerCase) "") (or (some-> text .toLowerCase) ""))]
|
||||
match))
|
||||
valid-matches (if (and not-found-description text)
|
||||
@@ -111,10 +111,14 @@
|
||||
nil)]))})))
|
||||
|
||||
(defn get-valid-entity-matches [matches not-found-description not-found-value text match->text]
|
||||
(let [valid-matches (take 5 (for [[match i] (map vector matches (range))
|
||||
:let [t (match->text match)]
|
||||
:when (str/includes? (or (some-> t .toLowerCase) "") (or (some-> text .toLowerCase) ""))]
|
||||
match))
|
||||
(let [valid-matches (->> (for [[match i] (map vector matches (range))
|
||||
:let [t (match->text match)
|
||||
match-index (str/index-of (or (some-> t .toLowerCase) "") (or (some-> text .toLowerCase) ""))]
|
||||
:when match-index]
|
||||
[match match-index ])
|
||||
(sort-by second)
|
||||
(map first)
|
||||
(take 10))
|
||||
valid-matches (if (and not-found-description text)
|
||||
(concat valid-matches [[:not-found (not-found-description text) (not-found-value text)]])
|
||||
valid-matches)]
|
||||
|
||||
Reference in New Issue
Block a user