This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-02
Channels
- # adventofcode (47)
- # announcements (7)
- # aws (1)
- # babashka (52)
- # beginners (80)
- # boot (3)
- # calva (19)
- # cider (9)
- # cljs-dev (1)
- # clojure (48)
- # clojure-brasil (1)
- # clojure-dev (27)
- # clojure-europe (3)
- # clojure-madison (3)
- # clojure-nl (29)
- # clojure-spec (11)
- # clojure-sweden (1)
- # clojure-uk (49)
- # clojurescript (66)
- # core-async (20)
- # cryogen (4)
- # cursive (13)
- # data-science (7)
- # datomic (5)
- # emacs (30)
- # figwheel-main (11)
- # fulcro (15)
- # graphql (8)
- # jobs (5)
- # joker (17)
- # lambdaisland (1)
- # leiningen (2)
- # malli (2)
- # off-topic (5)
- # pathom (22)
- # re-frame (12)
- # reagent (29)
- # reitit (2)
- # ring (10)
- # shadow-cljs (57)
- # specter (3)
- # tools-deps (22)
- # vim (5)
- # xtdb (7)
I want to find all documents with a certain :crux.db/id
prefix, what is the best practice? Ie (crux/q (crux/db node) '{:find [?e] :where [[?e :crux.db/id ?id] [(clojure.string/starts-with? ?id ":myprefix")]]})
Hi @U5JQAQE4X! Unfortunately there is no way to do this efficiently - is there a reason why you can't introduce a new attribute?
I think I have a attribute which works already, thanks for the idea! I just am doing some greenfield / hobby work with Crux and wanted to understand how to interact, so this helps
@UECLGBLES hey! I think with Datomic you could use the raw AVE index to jump straight to a prefix range and retrieve a set of db.unique/identity
values. An equivalent is not currently possible in Crux due to:
1) keywords are hashed in the indexes so such values (including usage as :crux.db/id
) won't end up sorted alphanumerically (see codec.clj)
2) you cannot access the the raw indexes - even if you could there could well be a lot more processing cost required than with Datomic due to the extra time dimension (depending on the shape and size of your data history)