mirror of
https://github.com/logseq/logseq.git
synced 2026-05-28 22:49:53 +00:00
add log to debug search
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
Bump to force a rebuild when the index format changes."
|
||||
1)
|
||||
|
||||
(def ^:private search-index-build-batch-size 200)
|
||||
(def ^:private search-index-build-batch-size 1000)
|
||||
(def ^:private search-index-build-time-budget-ms 8)
|
||||
(def ^:private search-index-build-idle-diff-ms 1000)
|
||||
(def ^:private search-index-build-pause-ms 300)
|
||||
@@ -904,6 +904,7 @@
|
||||
(keep #(d/entity db (:e %)))
|
||||
(remove search/hidden-entity?)
|
||||
(keep search/block->index))]
|
||||
(prn :debug :build-search-indice :remaining (count remaining))
|
||||
(when (seq indexed)
|
||||
(search/upsert-blocks! search-db (bean/->js indexed)))
|
||||
(p/let [_ (js/Promise. (fn [resolve] (js/setTimeout resolve 0)))]
|
||||
|
||||
@@ -448,18 +448,20 @@ DROP TRIGGER IF EXISTS blocks_au;
|
||||
"Build a block title indice from scratch.
|
||||
Incremental page title indice is implemented in frontend.search.sync-search-indice!"
|
||||
[repo db]
|
||||
(let [blocks (->> (get-all-fuzzy-supported-blocks db)
|
||||
(map block->index)
|
||||
(bean/->js))
|
||||
indice (fuse. blocks
|
||||
(clj->js {:keys ["title"]
|
||||
:shouldSort true
|
||||
:tokenize true
|
||||
:distance 1024
|
||||
:threshold 0.5 ;; search for 50% match from the start
|
||||
:minMatchCharLength 1}))]
|
||||
(swap! fuzzy-search-indices assoc repo indice)
|
||||
indice))
|
||||
(prn :debug :build-fuzzy-search-indice :graph repo)
|
||||
(time
|
||||
(let [blocks (->> (get-all-fuzzy-supported-blocks db)
|
||||
(map block->index)
|
||||
(bean/->js))
|
||||
indice (fuse. blocks
|
||||
(clj->js {:keys ["title"]
|
||||
:shouldSort true
|
||||
:tokenize true
|
||||
:distance 1024
|
||||
:threshold 0.5 ;; search for 50% match from the start
|
||||
:minMatchCharLength 1}))]
|
||||
(swap! fuzzy-search-indices assoc repo indice)
|
||||
indice)))
|
||||
|
||||
(defn fuzzy-search
|
||||
"Return a list of blocks (pages && tagged blocks) that match the query. Takes the following
|
||||
|
||||
Reference in New Issue
Block a user