Merge branch 'master' into feat/db

This commit is contained in:
Tienson Qin
2023-12-23 14:18:25 +08:00
82 changed files with 2056 additions and 1031 deletions

View File

@@ -480,12 +480,11 @@ Some bindings in this fn:
(string/replace tag-placeholder "#")))))
(defn- add-bindings!
[form q]
[q]
(let [forms (set (flatten q))
syms ['?b '?p 'not]
[b? p? not?] (-> (set/intersection (set syms) forms)
(map syms))
or? (contains? (set (flatten form)) 'or)]
(map syms))]
(cond
not?
(cond
@@ -501,16 +500,6 @@ Some bindings in this fn:
:else
q)
or?
(cond
(->> (flatten form)
(remove (every-pred string? page-ref/page-ref?))
(some string?)) ; block full-text search
(concat [['?b :block/content '?content]] [q])
:else
q)
(and b? p?)
(concat [['?b :block/page '?p]] q)
@@ -554,8 +543,7 @@ Some bindings in this fn:
;; [(not (page-ref ?b "page 2"))]
(keyword (ffirst result))
(keyword (first result)))]
(add-bindings! form
(if (= key :and) (rest result) result))))]
(add-bindings! (if (= key :and) (rest result) result))))]
{:query result'
:rules (if db-graph?
(rules/extract-rules rules/db-query-dsl-rules rules)