Skip to content

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

:art: Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964

Daniel1812e842191d
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 2d326bb3af..2194f58525 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -1588,7 +1588,7 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
items = append(items, item)
}
- groupKey, _ := attrView.GetKey(group.Field)
+ groupKey := view.GetGroupKey(attrView)
if nil == groupKey {
return
}
@@ -1611,9 +1611,19 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
return items[i].GetValue(group.Field).Number.Content < items[j].GetValue(group.Field).Number.Content
})
case av.GroupMethodDateDay, av.GroupMethodDateWeek, av.GroupMethodDateMonth, av.GroupMethodDateYear, av.GroupMethodDateRelative:
- sort.SliceStable(items, func(i, j int) bool {
- return items[i].GetValue(group.Field).Date.Content < items[j].GetValue(group.Field).Date.Content
- })
+ if av.KeyTypeCreated == groupKey.Type {
+ sort.SliceStable(items, func(i, j int) bool {
+ return items[i].GetValue(group.Field).Created.Content < items[j].GetValue(group.Field).Created.Content
+ })
+ } else if av.KeyTypeUpdated == groupKey.Type {
+ sort.SliceStable(items, func(i, j int) bool {
+ return items[i].GetValue(group.Field).Updated.Content < items[j].GetValue(group.Field).Updated.Content
+ })
+ } else if av.KeyTypeDate == groupKey.Type {
+ sort.SliceStable(items, func(i, j int) bool {
+ return items[i].GetValue(group.Field).Date.Content < items[j].GetValue(group.Field).Date.Content
+ })
+ }
}
var groupName string