feat: add page content level search plugin API

This commit is contained in:
Junyi
2022-11-24 00:25:33 +08:00
committed by Tienson Qin
parent 310e1a39f6
commit a241bb492e
2 changed files with 21 additions and 0 deletions

View File

@@ -31,6 +31,13 @@
(protocol/query e q opts))
(protocol/query e1 q opts)))
(query-page [_this q opts]
(println "D:Search > Query-page contents:" repo q opts)
(let [[e1 e2] (get-registered-engines repo)]
(doseq [e e2]
(protocol/query-page e q opts))
(protocol/query-page e1 q opts)))
(rebuild-blocks-indice! [_this]
(println "D:Search > Initial blocks indice!:" repo)
(let [[e1 e2] (get-registered-engines repo)]
@@ -43,6 +50,11 @@
(doseq [e (get-flatten-registered-engines repo)]
(protocol/transact-blocks! e data)))
(transact-pages! [_this data]
(println "D:Search > Transact pages!:" repo)
(doseq [e (get-flatten-registered-engines repo)]
(protocol/transact-pages! e data)))
(truncate-blocks! [_this]
(println "D:Search > Truncate blocks!" repo)
(doseq [e (get-flatten-registered-engines repo)]

View File

@@ -23,6 +23,9 @@
(query [_this q opts]
(call-service! service "search:query" (merge {:q q} opts) true))
(query-page [_this q opts]
(call-service! service "search:queryPage" (merge {:q q} opts) true))
(rebuild-blocks-indice! [_this]
;; Not pushing all data for performance temporarily
;;(let [blocks (search-db/build-blocks-indice repo)])
@@ -34,6 +37,12 @@
{:data {:added blocks-to-add
:removed blocks-to-remove-set}})))
(transact-pages! [_this data]
(let [{:keys [pages-to-remove-set pages-to-add]} data]
(call-service! service "search:transactpages"
{:data {:added pages-to-add
:removed pages-to-remove-set}})))
(truncate-blocks! [_this]
(call-service! service "search:truncateBlocks" {}))