Fork me on GitHub
#datomic
<
2018-09-10
>
sreekanth08:09:29

Hi, Can i use keywords with nested hierarchy for idents(Ex: :sample.some/state) and able to pull :sample ns datom :sample.some/state value, if both are written with same tx id.

kirill.salykin09:09:52

Hi, How I can fulltext filter based on multiple value. eg I want to to filter :person/name is John and Smith, so John Smith will match criteria and John West wont?

(d/q '[:find ?c
         :in $ ?filter
         :where
         ;; [?c :changeset/date ?date]
         [(fulltext $ :person/name ?filter) [[?c _ _ _]]]
         ]
       db
       ["John*" "Smith*"])

kirill.salykin09:09:51

Something like this doesnt work

kirill.salykin09:09:42

and collection binding uses or but I need and

kirill.salykin13:09:17

So datomic uses lucene underneath thanks!

kirill.salykin14:09:54

@U09R86PA4 should I write something like

(fulltext % :person/name "John AND Smith")
?

kirill.salykin14:09:56

how datomic will understand this is lucene part?

favila14:09:24

datomic passes it straight through

favila14:09:49

fulltext is a function which issues a query against the lucene index for the attr

favila14:09:15

it's a query in a query; the fulltext query itself is opaque to the rest of datomic

kirill.salykin14:09:33

or should I use

"\"John\" AND \"Smith\""

kirill.salykin14:09:58

I think later is correct Thanks!

steveb8n13:09:41

there are hints that Cloud will soon have an integration to ElasticSearch. It’s probably better to use that than fulltext in Datomic since it is not very good for search and has other limitations

kirill.salykin14:09:05

with pull api can I make nested attributes flat?

kirill.salykin14:09:16

with :as maybe?

favila14:09:23

no; pull can only do renaming and limiting results, not changes in shape

pvillegas1222:09:22

I don’t understand what (d/pull db {:eid ident :selector [:db/ident]}) means

favila23:09:53

This means exactly the same thing as (d/pull db [:db/ident] ident)

favila23:09:12

i.e. get entity indicated by ident (whatever that value is, I guess you mean a :db/ident keyword like an attribute name) and give me a map like {:db/ident X} with X being that entity's value for :db/ident

👍 4
pvillegas1223:09:02

Relatedly, I’m trying to use pull to get data for multiple entities. For example, I want all entities with :inv/name

favila23:09:05

pull only walks a graph from a supplied point. You need a query

favila23:09:33

[?e :inv/name] then pull whatever you want from ?e (if anything)

favila23:09:26

(d/q '[:find (pull ?e [:db/id :inv/name]) :where [?e :inv/name] db)

👍 4
favila23:09:28

for example