datascript

Richie 2023-08-31T23:48:55.401189Z

Is eav sorted by v? I'm pretty sure that's the case but I want to make sure. https://github.com/tonsky/datascript/wiki/Tips-&-tricks#getting-top-10-entities-by-some-attribute kinda indicates it but it's specifically talking about ave. https://github.com/kristianmandrup/datascript-tutorial/blob/7d2b684611061ab117101317fe5059c6377d8728/datascript_architecture.md#db says that each index is a sorted set of datoms. Although it's not explicit enough that I'm not worried about it. Like, it's not only sorted by ea and is also sorted by v , right? Thanks!

2023-08-31T23:54:45.746379Z

the index names refer to the sort order, eav is sorted by entity, attribibute, value

Richie 2023-08-31T23:55:23.933719Z

Ok, great. So it's sorted by value too. That's what I was sweating.

2023-08-31T23:59:14.365869Z

https://github.com/tonsky/datascript/blob/master/src/datascript/db.cljc#L493-L512 is where the comparison functions are defined

2023-08-31T23:59:44.976589Z

https://github.com/tonsky/datascript/blob/master/src/datascript/db.cljc#L975-L977 is where the sorted sets using the comparison functions are created for each index

Richie 2023-09-01T00:01:47.211339Z

Thank you! I got lost when I tried looking through the code.

Niki 2023-09-01T16:00:47.323189Z

Yes should be sorted

👍 1