An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve handling of database column filters containing empty values Fix https://github.com/siyuan-note/siyuan/issues/9394
Danielccb65454a2ba
diff --git a/kernel/av/table.go b/kernel/av/table.goindex e9d69107a6..536de5cd74 100644--- a/kernel/av/table.go+++ b/kernel/av/table.go@@ -165,8 +165,8 @@ func (value *Value) Compare(other *Value) int {}func (value *Value) CompareOperator(other *Value, operator FilterOperator) bool {- if nil == value || nil == other {- return false+ if nil == other {+ return true}if nil != value.Block && nil != other.Block {@@ -193,16 +193,34 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) boolif nil != value.Text && nil != other.Text {switch operator {case FilterOperatorIsEqual:+ if "" == strings.TrimSpace(other.Text.Content) {+ return true+ }return value.Text.Content == other.Text.Contentcase FilterOperatorIsNotEqual:+ if "" == strings.TrimSpace(other.Text.Content) {+ return true+ }return value.Text.Content != other.Text.Contentcase FilterOperatorContains:+ if "" == strings.TrimSpace(other.Text.Content) {+ return true+ }return strings.Contains(value.Text.Content, other.Text.Content)case FilterOperatorDoesNotContain:+ if "" == strings.TrimSpace(other.Text.Content) {+ return true+ }return !strings.Contains(value.Text.Content, other.Text.Content)case FilterOperatorStartsWith:+ if "" == strings.TrimSpace(other.Text.Content) {+ return true+ }return strings.HasPrefix(value.Text.Content, other.Text.Content)case FilterOperatorEndsWith:+ if "" == strings.TrimSpace(other.Text.Content) {+ return true+ }return strings.HasSuffix(value.Text.Content, other.Text.Content)case FilterOperatorIsEmpty:return "" == strings.TrimSpace(value.Text.Content)@@ -214,8 +232,14 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) boolif nil != value.Number && nil != other.Number {switch operator {case FilterOperatorIsEqual:+ if !other.Number.IsNotEmpty {+ return true+ }return value.Number.Content == other.Number.Contentcase FilterOperatorIsNotEqual:+ if !other.Number.IsNotEmpty {+ return true+ }return value.Number.Content != other.Number.Contentcase FilterOperatorIsGreater:return value.Number.Content > other.Number.Content@@ -235,8 +259,14 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) boolif nil != value.Date && nil != other.Date {switch operator {case FilterOperatorIsEqual:+ if !other.Date.IsNotEmpty {+ return true+ }return value.Date.Content == other.Date.Contentcase FilterOperatorIsNotEqual:+ if !other.Date.IsNotEmpty {+ return true+ }return value.Date.Content != other.Date.Contentcase FilterOperatorIsGreater:return value.Date.Content > other.Date.Content@@ -541,7 +571,17 @@ func (table *Table) FilterRows() {for _, row := range table.Rows {pass := truefor j, index := range colIndexes {- if !row.Cells[index].Value.CompareOperator(table.Filters[j].Value, table.Filters[j].Operator) {+ operator := table.Filters[j].Operator++ if nil == row.Cells[index].Value {+ switch operator {+ case FilterOperatorIsNotEmpty:+ pass = false+ }+ break+ }++ if !row.Cells[index].Value.CompareOperator(table.Filters[j].Value, operator) {pass = falsebreak}