Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve rel/rollup sort https://ld246.com/article/1752679409595

Daniel4179c8f2452a
diff --git a/kernel/av/sort.go b/kernel/av/sort.go
index 56ca2eaa2a..1dac261fce 100644
--- a/kernel/av/sort.go
+++ b/kernel/av/sort.go
@@ -397,7 +397,7 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
}
case KeyTypeRelation:
if nil != value.Relation && nil != other.Relation {
- if 1 < len(value.Relation.Contents) && 1 < len(other.Relation.Contents) && KeyTypeNumber == value.Relation.Contents[0].Type && KeyTypeNumber == other.Relation.Contents[0].Type {
+ if 0 < len(value.Relation.Contents) && 0 < len(other.Relation.Contents) && KeyTypeNumber == value.Relation.Contents[0].Type && KeyTypeNumber == other.Relation.Contents[0].Type {
v1, ok1 := util.Convert2Float(value.Relation.Contents[0].String(false))
v2, ok2 := util.Convert2Float(other.Relation.Contents[0].String(false))
if ok1 && ok2 {
@@ -435,7 +435,7 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
}
case KeyTypeRollup:
if nil != value.Rollup && nil != other.Rollup {
- if 1 < len(value.Rollup.Contents) && 1 < len(other.Rollup.Contents) && KeyTypeNumber == value.Rollup.Contents[0].Type && KeyTypeNumber == other.Rollup.Contents[0].Type {
+ if 0 < len(value.Rollup.Contents) && 0 < len(other.Rollup.Contents) && KeyTypeNumber == value.Rollup.Contents[0].Type && KeyTypeNumber == other.Rollup.Contents[0].Type {
v1, ok1 := util.Convert2Float(value.Rollup.Contents[0].String(false))
v2, ok2 := util.Convert2Float(other.Rollup.Contents[0].String(false))
if ok1 && ok2 {