mirror of https://github.com/logseq/logseq
fix: a bug cause page content cache outdate when external edition happens
parent
05ff96ebf9
commit
6785486047
|
@ -169,7 +169,8 @@
|
||||||
[repo pages]
|
[repo pages]
|
||||||
(if-let [db (get-db repo)]
|
(if-let [db (get-db repo)]
|
||||||
;; TODO: what if a CONFLICT on uuid
|
;; TODO: what if a CONFLICT on uuid
|
||||||
(let [insert (prepare db "INSERT INTO pages (id, uuid, content) VALUES (@id, @uuid, @content) ON CONFLICT (id) DO UPDATE SET content = @content")
|
;; Should update all values on id conflict
|
||||||
|
(let [insert (prepare db "INSERT INTO pages (id, uuid, content) VALUES (@id, @uuid, @content) ON CONFLICT (id) DO UPDATE SET (uuid, content) = (@uuid, @content)")
|
||||||
insert-many (.transaction ^object db
|
insert-many (.transaction ^object db
|
||||||
(fn [pages]
|
(fn [pages]
|
||||||
(doseq [page pages]
|
(doseq [page pages]
|
||||||
|
@ -190,7 +191,8 @@
|
||||||
[repo blocks]
|
[repo blocks]
|
||||||
(if-let [db (get-db repo)]
|
(if-let [db (get-db repo)]
|
||||||
;; TODO: what if a CONFLICT on uuid
|
;; TODO: what if a CONFLICT on uuid
|
||||||
(let [insert (prepare db "INSERT INTO blocks (id, uuid, content, page) VALUES (@id, @uuid, @content, @page) ON CONFLICT (id) DO UPDATE SET content = @content")
|
;; Should update all values on id conflict
|
||||||
|
(let [insert (prepare db "INSERT INTO blocks (id, uuid, content, page) VALUES (@id, @uuid, @content, @page) ON CONFLICT (id) DO UPDATE SET (uuid, content, page) = (@uuid, @content, @page)")
|
||||||
insert-many (.transaction ^object db
|
insert-many (.transaction ^object db
|
||||||
(fn [blocks]
|
(fn [blocks]
|
||||||
(doseq [block blocks]
|
(doseq [block blocks]
|
||||||
|
|
|
@ -331,6 +331,8 @@
|
||||||
nil)]))
|
nil)]))
|
||||||
|
|
||||||
(rum/defc search-auto-complete
|
(rum/defc search-auto-complete
|
||||||
|
"has-more? - if the result is truncated
|
||||||
|
all? - if true, in show-more mode"
|
||||||
[{:keys [engine pages files pages-content blocks has-more?] :as result} search-q all?]
|
[{:keys [engine pages files pages-content blocks has-more?] :as result} search-q all?]
|
||||||
(let [pages (when-not all? (map (fn [page]
|
(let [pages (when-not all? (map (fn [page]
|
||||||
(let [alias (model/get-redirect-page-name page)]
|
(let [alias (model/get-redirect-page-name page)]
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
(text/remove-level-spaces content format (config/get-block-pattern format)))
|
(text/remove-level-spaces content format (config/get-block-pattern format)))
|
||||||
|
|
||||||
(defn search
|
(defn search
|
||||||
|
"The aggretation of search results"
|
||||||
([q]
|
([q]
|
||||||
(search (state/get-current-repo) q))
|
(search (state/get-current-repo) q))
|
||||||
([repo q]
|
([repo q]
|
||||||
|
|
|
@ -111,6 +111,9 @@
|
||||||
(protocol/transact-blocks! engine data)))
|
(protocol/transact-blocks! engine data)))
|
||||||
|
|
||||||
(defn- transact-pages!
|
(defn- transact-pages!
|
||||||
|
"Transact pages to search engine
|
||||||
|
:pages-to-remove-set the set of pages to remove (not include those to update)
|
||||||
|
:pages-to-add the page entities to add"
|
||||||
[repo data]
|
[repo data]
|
||||||
(when-let [engine (get-engine repo)]
|
(when-let [engine (get-engine repo)]
|
||||||
(protocol/transact-pages! engine data)))
|
(protocol/transact-pages! engine data)))
|
||||||
|
|
Loading…
Reference in New Issue