Fork me on GitHub
#datascript
<
2023-08-31
>
Richie23:08:55

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-&amp;-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!

hiredman23:08:45

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

Richie23:08:23

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

hiredman23:08:44

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

Richie00:09:47

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

Niki16:09:47

Yes should be sorted

👍 2