Hello I am new to datascript and I explore Athens codebase that uses it.
Playing with datascript.core/datoms
I get an error with the :avet
index:
#error {:message "Attribute :block/string should be marked as :db/index true", :data {:error :index-access, :index :avet, :components [:block/string]}}
Where should I declare this :db/index true
?
here is my lookup (d/datoms @dsdb :avet :block/string)
I tried to edit the schema here without much success
https://github.com/athensresearch/athens/blob/main/src/cljs/athens/db.cljs#L126-L134
my new schema looks like this with :block/string
added
@@ -131,7 +130,8 @@
:block/children {:db/cardinality :db.cardinality/many
:db/valueType :db.type/ref}
:block/refs {:db/cardinality :db.cardinality/many
- :db/valueType :db.type/ref}})
+ :db/valueType :db.type/ref}
+ :block/string {:db/index true}})
@emilien without looking at the doc's that seems reasonable, are you still getting the error?
yes, but I think it has something to do with the way the db is created on Athens side.
Because in the REPL I can see the index when I do (d/empty-db schema)
But the index is notthere when I inspect the schema for the datascript db that is defined here https://github.com/athensresearch/athens/blob/main/src/cljs/athens/db.cljs#L137
It must be reset somewhere else. I need to dig more.