From bdaf3f4bfbb1681c6500aa32f8fb8d70d9e30690 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 8 Mar 2024 00:58:33 +0800 Subject: [PATCH] :bug: Database filtering for specific dates not working Fix https://github.com/siyuan-note/siyuan/issues/10518 --- kernel/av/table.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/av/table.go b/kernel/av/table.go index a55e0dcffe5..1cf9c25d75f 100644 --- a/kernel/av/table.go +++ b/kernel/av/table.go @@ -325,10 +325,12 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, rowID st return false } - if nil != value.Relation && KeyTypeRelation == value.Type && nil != filter && nil != filter.Value && KeyTypeRelation == filter.Value.Type && - nil != filter.Value.Relation && 0 < len(filter.Value.Relation.Contents) { + if nil != value.Relation && KeyTypeRelation == value.Type && 0 < len(value.Relation.Contents) && nil != filter && nil != filter.Value && KeyTypeRelation == filter.Value.Type && + nil != filter.Value.Relation && 0 < len(filter.Value.Relation.BlockIDs) && 0 < len(filter.Value.Relation.BlockIDs) { // 单独处理关联类型的比较 - return value.filter(filter.Value.Relation.Contents[0], filter.RelativeDate, filter.RelativeDate2, filter.Operator) + relationValue := value.Relation.Contents[0] + filterValue := &Value{Type: KeyTypeBlock, Block: &ValueBlock{Content: filter.Value.Relation.BlockIDs[0]}} + return relationValue.filter(filterValue, filter.RelativeDate, filter.RelativeDate2, filter.Operator) } return value.filter(filter.Value, filter.RelativeDate, filter.RelativeDate2, filter.Operator)