Fork me on GitHub
#datomic
<
2022-07-21
>
Athan08:07:30

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.

pyry10:07:56

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.

pyry10:07:15

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.

pyry10:07:58

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.

favila20:07:54

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?

Joe Lane20:07:00

@U09R86PA4 default writeConcurrency is 4, making default readConcurrency 8. I understand peers don't have write concurrency, you'll just have to trust me 🙂