Fork me on GitHub
#datomic
<
2020-04-02
>
motform09:04:18

I have a quick question about how fulltext search works. I have an es with multiple strings fields, which I have concatenated together and and added to the db under :e/fulltext, all of which works. However, I’m a bit lost on how queries with fulltext work. Lets say I have tokens s1 and s2, I assumed that two calls to fulltext would result in an “and” search, which it seems to be doing. However, when I call fulltext just once with the string "s1 s2" I get a different result, returning a much larger amount of es. I’m guessing its the first behaviour that I want, I got a bit confused by the noticeably large discrepancy in return values (in one example, separate calls returned 12 items, while a concatenated single called returned 300+).

favila12:04:40

The string given to fulltext is a lucene query string: https://lucene.apache.org/core/2_9_4/queryparsersyntax.html

favila12:04:46

the default operator for terms is OR

favila12:04:56

“s1 s2” = “s1 OR s2"

motform15:04:21

Thank you so much as always, that makes sense. I was surprised that lucene was not mentioned in the docs. I mean, its kind of an implementation detail, but also kind of not really, as the DSL still works

bmaddy15:04:57

Is there some way to get the datomic version in the repl? I'm thinking something like

d/*datomic-version*

bmaddy15:04:44

For context, what I'm actually trying to figure out is why this doesn't work:

(d/q '[:find (pull ?e [[:db/doc :as "doc"]])
              :where
              [?e :db/ident :db.type/boolean]]
            (d/db conn))
Execution error (Exceptions$IllegalArgumentExceptionInfo) at datomic.error/arg (error.clj:57).
:db.error/invalid-attr-spec Cannot interpret as an attribute spec: [:db/doc :as "doc"] of class: class clojure.lang.PersistentVector
and I'm wondering if I have an old datomic version or something.

bmaddy15:04:05

Nevermind, I was able to figure out the version another way. My datomic is too old, so that's probably the problem.

👍 4