This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-22
Channels
- # announcements (11)
- # babashka (4)
- # beginners (98)
- # calva (18)
- # chlorine-clover (1)
- # cider (44)
- # clj-kondo (6)
- # clojure (61)
- # clojure-australia (4)
- # clojure-dev (4)
- # clojure-europe (132)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-uk (31)
- # clojurescript (40)
- # community-development (8)
- # conjure (20)
- # data-science (1)
- # datomic (42)
- # defnpodcast (6)
- # emacs (3)
- # events (1)
- # fulcro (9)
- # graphql (2)
- # hugsql (1)
- # jobs (1)
- # malli (4)
- # off-topic (28)
- # pathom (27)
- # rdf (1)
- # re-frame (10)
- # reagent (4)
- # remote-jobs (1)
- # reveal (32)
- # sci (5)
- # shadow-cljs (18)
- # spacemacs (1)
- # tools-deps (62)
- # xtdb (4)
Hi! I am currently evaluating crux for a use-case at my company on recommendation by Alexis (Keplar16). This is some really cool tech! I do have a small question: is it possible to query on nested maps? For example:
[[:a :labels {:x 'true' :z 'false'}]]
is there a way to query for labels -> x
without flattening things into the form:
[[:a :labels/x 'true']
[{:a :labels/z 'false'}]
The reason I ask is I want to be able to project all possible labels on a document, which would, perhaps naively, require me to store the labels as a map in addition to the flattened keys
Hey @U940MBY3T 🙂 Crux doesn't index map values in this way, but if you're looking to query for labels it might be worth using a set - you can then query for set membership:
(crux/submit-tx (crux-node)
[[:crux.tx/put {:crux.db/id :a
:labels #{:x :y}}]])
(crux/q (crux/db (crux-node))
'{:find [?e]
:where [[?e :label :x]]})
;; => #{[:a]}
Thanks, I like that