This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-08
Channels
- # announcements (10)
- # beginners (53)
- # calva (22)
- # clj-kondo (21)
- # cljs-dev (1)
- # clojure (18)
- # clojure-europe (2)
- # clojure-filipino (1)
- # clojure-indonesia (1)
- # clojure-my (1)
- # clojure-seattle (6)
- # clojure-sg (1)
- # clojurescript (60)
- # code-reviews (3)
- # conjure (1)
- # cursive (1)
- # datomic (2)
- # figwheel-main (1)
- # fulcro (2)
- # gratitude (1)
- # honeysql (35)
- # lsp (6)
- # malli (5)
- # meander (11)
- # off-topic (27)
- # other-languages (3)
- # play-clj (1)
- # portal (31)
- # sql (13)
- # xtdb (5)
Is this a bug?
user=> (xt/q (xt/db node) '{:find [(pull v? [*])] :where [[v? :x/type :v] (or-join [v?] [v? :v/vin "vin-1"])] :limit 10} )
; get 1 record with attribute :v/vin as "vin-1"
user=> (xt/q (xt/db node) '{:find [(pull v? [*])] :where [[v? :x/type :v] (or-join [v?] [v? :v/vin x])] :in [[x ...]] :limit 10} ["vin-1"] )
; get 10 records with different attribute values for :v/vin
Hey, I think you need to add the x
to the or-join
rule-var vector (i.e. (or-join [?v x] ...)
which determines the scoping) and it should work. In other words, you currently have two completely disconnected (non-unified) logic vars for x
I was just testing it with:
(with-open [n (xt/start-node {})]
(xt/submit-tx n [[::xt/put {:xt/id :foo :a 1 :t :t}]
[::xt/put {:xt/id :bar :a 2 :t :t}]])
(xt/sync n)
[(xt/q (xt/db n) '{:find [e]
:where [[e :t :t]
(or-join [e]
[e :a 1])]
:limit 10})
(xt/q (xt/db n) '{:find [e]
:in [[x ...]]
:where [[e :t :t]
(or-join [e x]
[e :a x])]
:limit 10}
[1])]
)