datomic

mkvlr 2025-04-08T12:11:21.320489Z

if you’re using classpath functions, can you say if you’re updating them with 1) 🔌 transactor restart or 2) clojure-spin using the repl? Please comment on how you’re doing it an if it’s working well for you.

1
🔌 3
frankitox 2025-04-08T22:24:35.578229Z

Hi! I have a newbie question. This is the basic query I wrote:

(d/q '[:find ?u
       :in $ ?useremail
       :where
       [?u :user/email ?email]
       [?u :user/name ?uname]
       [(my.utils/fuzzy-match ?uname ?useremail)]]
      db "Alice")
I would like to change it so that Datomic returns all users with an email that either match whatever my.utils/fuzzy-match returns OR don't actually have a :user/name attribute.

✅ 1
frankitox 2025-04-08T22:53:02.925769Z

I ended up with something like this

(d/q '[:find [?u ...]
       :in $ ?useremail
       :where
       [?u :user/email]
       (or-join [?u ?useremail]
                (and [?u :user/email ?email]
                     [(my.utils/fuzzy-match ?email ?useremail)])
                (and [?u :user/name ?uname]
                     [(my.utils/fuzzy-match ?uname ?useremail)]))]
     db "Alice")
Which seems to work for my use case

favila 2025-04-08T22:54:47.504719Z

This seems different from what you asked for? This applies fuzzymatch to username and email, includes ?u if either one matches.

frankitox 2025-04-08T23:08:02.730069Z

Yep, in the initial question I simplified it a bit

favila 2025-04-08T23:09:12.737599Z

"OR don't actually have a :user/name attribute." is not what you actually want?

frankitox 2025-04-08T23:14:17.032149Z

It's not. I got confused because all my users have an email but the name is optional