Skip to content

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

:art: Improve av https://github.com/siyuan-note/siyuan/issues/15565

Daniel599cf0cf461d
diff --git a/kernel/av/filter.go b/kernel/av/filter.go
index cded60be15..7a6b94f6da 100644
--- a/kernel/av/filter.go
+++ b/kernel/av/filter.go
@@ -26,11 +26,11 @@ import (
// ViewFilter 描述了视图过滤规则的结构。
type ViewFilter struct {
- Column string `json:"column"` // 列(字段)ID
- Operator FilterOperator `json:"operator"` // 过滤操作符
- Value *Value `json:"value"` // 过滤值
- RelativeDate *RelativeDate `json:"relativeDate"` // 相对时间
- RelativeDate2 *RelativeDate `json:"relativeDate2"` // 第二个相对时间,用于某些操作符,比如 FilterOperatorIsBetween
+ Column string `json:"column"` // 列(字段)ID
+ Operator FilterOperator `json:"operator"` // 过滤操作符
+ Value *Value `json:"value"` // 过滤值
+ RelativeDate *RelativeDate `json:"relativeDate,omitempty"` // 相对时间
+ RelativeDate2 *RelativeDate `json:"relativeDate2,omitempty"` // 第二个相对时间,用于某些操作符,比如 FilterOperatorIsBetween
}
type RelativeDateUnit int
@@ -360,6 +360,10 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa
}
case KeyTypeSelect, KeyTypeMSelect:
if nil != value.MSelect {
+ if 1 > len(other.MSelect) {
+ return true
+ }
+
switch operator {
case FilterOperatorIsEqual, FilterOperatorContains:
contains := false
diff --git a/kernel/av/value.go b/kernel/av/value.go
index 2c5380661b..cb41e279f4 100644
--- a/kernel/av/value.go
+++ b/kernel/av/value.go
@@ -374,11 +374,11 @@ func (value *Value) GetValByType(typ KeyType) (ret interface{}) {
}
type ValueBlock struct {
- ID string `json:"id"` // 绑定的块 ID,非绑定块时为空
- Icon string `json:"icon"`
+ ID string `json:"id,omitempty"` // 绑定的块 ID,非绑定块时为空
+ Icon string `json:"icon,omitempty"`
Content string `json:"content"`
- Created int64 `json:"created"`
- Updated int64 `json:"updated"`
+ Created int64 `json:"created,omitempty"`
+ Updated int64 `json:"updated,omitempty"`
}
type ValueText struct {