Explorar o código

fix: limit page searchs and make it more accurate

Tienson Qin %!s(int64=5) %!d(string=hai) anos
pai
achega
3ff3d13389
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  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