This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-21
Channels
- # announcements (11)
- # architecture (8)
- # aws (7)
- # babashka (1)
- # beginners (55)
- # calva (52)
- # cider (4)
- # clj-kondo (5)
- # clojure (12)
- # clojure-europe (7)
- # clojure-uk (3)
- # clojurescript (40)
- # clr (1)
- # conjure (5)
- # data-oriented-programming (7)
- # datomic (8)
- # emacs (3)
- # events (1)
- # graphql (2)
- # honeysql (5)
- # lsp (7)
- # missionary (24)
- # nbb (10)
- # off-topic (12)
- # pathom (5)
- # reagent (9)
- # reitit (4)
- # schema (1)
- # sci (9)
- # shadow-cljs (2)
- # specter (6)
- # tools-deps (4)
- # xtdb (13)
Hi, I am playing with https://github.com/Datomic/mbrainz-sample It has been restored from a Datomic backup following the instructions and it is running on premises with a Postgres transactor and datomic.api (datomic in-process peer library). I executed this query that uses a rule for full-text search "https://github.com/Datomic/mbrainz-sample/wiki/Queries#what-are-the-titles-artists-album-names-and-release-years-of-all-tracks-having-the-word-always-in-their-titles?" And I am getting back => #{ } A little investigation on the attributes of :track/name shows that
(d/attribute db :track/name)
=>
#AttrInfo{:id 80,
:ident :track/name,
:value-type :db.type/string,
:cardinality :db.cardinality/one,
:indexed true,
:has-avet true,
:unique nil,
:is-component false,
:no-history false,
:fulltext false}
Therefore full-text search is not enabled. I tried to modify the schema by adding the :db/fulltext attribute
(d/transact conn [[:db/add [:db/ident :track/name] :db/fulltext true]
[:db/add "datomic.tx" :db/doc "enable full-text search for :track/name"]])
;; but it fails....
;; :db.error/invalid-alter-attribute
;; Error: {:db/error :db.error/unsupported-alter-schema,
;; :entity :track/name, :attribute :db/fulltext, :from :disabled, :to true}"
So how am I supposed to run this query with full-text search, any suggestions ?
PS: I made a quick search but I did not find any useful answer on this case. Moreover I did not see any information about how to do full-text search on the https://github.com/Datomic/https://github.com/Datomic/mbrainz-sample repository.Only specific schema attributes can be changed as per the above reference; specifically, you can never change if an entity should be indexed for full-text search or not.
The second category of alteration is altering schema attributes of attributes. The supported attributes to alter include :db/cardinality, :db/isComponent, :db/noHistory, :db/index and :db/unique.
You can never alter :db/valueType, :db/fulltext, :db/tupleAttrs, :db/tupleTypes, or :db/tupleType.
As for how to run the query without full text search, you could instead try using Java interop as specified in https://docs.datomic.com/on-prem/query/query.html#calling-instance-methods.
A suitable candidate for this could be eg. https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#contains(java.lang.CharSequence).
There’s an on-prem setting datomic.readConcurrency
for peers (not just transactors) according to https://docs.datomic.com/on-prem/configuration/system-properties.html#peer-properties. It says the default is 2x write concurrency…but peers don’t have write concurrency. What is the actual default?
@U09R86PA4 default writeConcurrency is 4, making default readConcurrency 8. I understand peers don't have write concurrency, you'll just have to trust me 🙂