Просмотр исходного кода

fix: limit page searchs and make it more accurate

Tienson Qin 5 лет назад
Родитель
Сommit
3ff3d13389
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      src/main/frontend/search.cljs

+ 3 - 2
src/main/frontend/search.cljs

@@ -49,7 +49,8 @@
                      (map (fn [p] {:name p}))
                      (bean/->js))
           indice (fuse. pages
-                        (clj->js {:keys ["name"]}))]
+                        (clj->js {:keys ["name"]
+                                  :threshold 0.4}))]
       (swap! indices assoc-in [repo :pages] indice)
       indice)))
 
@@ -170,7 +171,7 @@
        (when-not (string/blank? q)
          (let [indice (or (get-in @indices [repo :pages])
                           (make-pages-indice!))
-               result (->> (go q indice {})
+               result (->> (go q indice (clj->js {:limit limit}))
                            (bean/->clj))]
            ;; TODO: add indexes for highlights
            (->> (map