This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-21
Channels
- # admin-announcements (42)
- # alda (1)
- # beginners (11)
- # boot (24)
- # boulder-clojurians (2)
- # cider (10)
- # cljs-dev (23)
- # clojure (63)
- # clojure-czech (4)
- # clojure-japan (2)
- # clojure-russia (44)
- # clojure-sg (2)
- # clojure-switzerland (2)
- # clojurescript (135)
- # community-development (5)
- # css (4)
- # cursive (19)
- # datomic (34)
- # emacs (2)
- # events (5)
- # funcool (13)
- # hoplon (3)
- # ldnclj (43)
- # ldnproclodo (1)
- # lein-figwheel (7)
- # luminus (7)
- # off-topic (54)
- # om (115)
- # onyx (82)
- # overtone (3)
- # re-frame (6)
- # reagent (15)
- # yada (5)
@robert-stuttaford: I did the mocking stuff on my dev laptop, it takes on average 2ms to create a mock db and run one transaction on it
So yeah, good for testing.
@dsapoetra: what's your series of repl commands?
can anyone help with a query I'm trying to build? https://gist.github.com/bostonaholic/30e31f4620804632d3c8
full-search
is what's falling apart
@bostonaholic: Oh, I mean ?person
and ?query
I've tried the or-join
and it still doesn't work
well, at least I don't get the exception. But only Bob is returned
I updated the gist to use or-join
works fine for me with clj re-pattern and your or-join
(defn full-search [db query]
(d/q '[:find [(pull ?person [* {:person/address [*]}]) ...]
:in $ ?query
:where
(or-join [?person ?query]
(and
[?person :person/name ?name]
[(re-find ?query ?name)])
(and
[?person :person/address ?address]
[?address :address/street ?street]
[(re-find ?query ?street)]))]
db
(re-pattern (str "(?i).*" query ".*"))))
https://gist.github.com/bostonaholic/30e31f4620804632d3c8#file-datomic-search-clj-L27 should be :db.part/user
Also gist contains a couple of tempid partition typos
yeah ^ that one
ha, thanks
I just ran this with the typos fixed, and it does return the expected results (Bob and Charles)
@bostonaholic can confirm what @jgdavey sees (working as expected), w/1.7.0_60 and 0.9.5327 — so I expect issue is in data.
YAY, it works!
thanks for your help @bkamphaus and @jgdavey
I've updated the gist with an added bit of complexity. Note that line #102 works, but #96 does not https://gist.github.com/bostonaholic/30e31f4620804632d3c8
(load-file "datomic-search.clj")
works great for that file
@dsapoetra: these commands work as expected for me in the IntelliJ repl: (require '[datomic.api :as d]) (d/create-database "datomic:<free://localhost:4334/sample-database%22|free://localhost:4334/sample-database">) (d/connect "datomic:<free://localhost:4334/sample-database%22|free://localhost:4334/sample-database">)
@bostonaholic: It seems like destructuring is tripping you up. Since you’re passing in an empty collection, the or-join cannot bind ?zip
. The query will always return nothing.
It’s probably not the most elegant way to do this, but it does work. Somebody else might be able to provide a more elegant way to destructure (i.e. without identity
).
interesting
I like my (conj zips "")
hack 😜
this is when I wish datomic was OSS so I could dig into the source to see if it's a bug, or a feature