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

Daniele75873911685
diff --git a/kernel/sql/av.go b/kernel/sql/av.go
index 747fb5d761..cd534fd2bc 100644
--- a/kernel/sql/av.go
+++ b/kernel/sql/av.go
@@ -633,8 +633,14 @@ func filterByQuery(query string, collection av.Collection) {
// manualSort 处理用户手动排序。
func manualSort(view *av.View, collection av.Collection) {
+ itemIDs := view.ItemIDs
+ // 如果是分组视图,则需要根据分组项的顺序进行排序
+ if 0 < len(view.GroupItemIDs) {
+ itemIDs = view.GroupItemIDs
+ }
+
sortItemIDs := map[string]int{}
- for i, itemID := range view.ItemIDs {
+ for i, itemID := range itemIDs {
sortItemIDs[itemID] = i
}