Fork me on GitHub
#datalevin
<
2023-06-14
>
Kein09:06:06

Hi folks, I encountered an issue where I’d like to remove data with :name attribute and failed. My context is as follows: [1] I put the example schema and data into the db. [2] The schema has a :name attribute with :unique :db.unique/identity constraint. [3] I loaded the data in [4] I tried to delete all data with

(d/transact! conn [ <a list of [:db.fn/retractEntity <id>]> ]
[5] I ran get-all to get all <eav>s and found that all the datoms with the form [e :name v] cannot be deleted, whereas datoms with all other attributes are deleted as expected. [6] I changed the schema with
(d/update-schema conn {:name {:db/valueType :db.type/string}})
so now name does not have the constraint [7] I did [4] again but [5] still held [8] I deleted the :name attribute [9] I ran [5] (get-all) and found the remaining datoms are in the form of [e nil v] The issues here are: [Q1] How do I delete data at context [4] [Q2] How do I delete data at context [9]

Huahai18:06:28

what is get-all?

Kein05:06:39

It is :

(defn get-all [] (d/q '[:find ?e ?a ?n
                             :where
                             [?e ?a ?n]] (d/db conn)))

Huahai22:06:28

Could you file an issue with a minimal reproducible code? Thanks.

flowthing13:06:03

I’m attempting to update from Datalevin 0.7.7 to 0.8.16 and there seems to be some sort of regression in full-text search. A query like this:

(d/q '[:find (pull ?e [*])
       :in $ ?q
       :where
       [(fulltext $ ?q) [[?e _ _]]]]
  db
  "query")
Throws an exception like this:
java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4
        at datalevin.utl.GrowingIntArray.get(GrowingIntArray.java:92)
        at datalevin.search.Candidate.get_tf(search.clj:173)
        at datalevin.search$score_term.invokeStatic(search.clj:287)
        at datalevin.search$score_term.invoke(search.clj:282)
        at datalevin.search$tf_idf_scoring.invokeStatic(search.clj:302)
        at datalevin.search$tf_idf_scoring.invoke(search.clj:293)
        at datalevin.search$score_docs$fn__17461.invoke(search.clj:566)
        at datalevin.search.SearchEngine$fn__17211.invoke(search.clj:408)
        ...
I’m having some trouble coming up with a minimal repro, but I’ll keep trying. Any tips appreciated. 🙂

Huahai18:06:34

You cannot just upgrade from 0.7 to 0.8. You need to export and import data.

flowthing18:06:46

I see, thanks!