Skip to content

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

:art: Database template columns support number filter Fix https://github.com/siyuan-note/siyuan/issues/9414

Daniel8fb35f5565c1
diff --git a/kernel/av/table.go b/kernel/av/table.go
index abdae0d17c..5bd0177f66 100644
--- a/kernel/av/table.go
+++ b/kernel/av/table.go
@@ -474,6 +474,65 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) bool
return 0 != len(value.MAsset) && !(1 == len(value.MAsset) && "" == value.MAsset[0].Content)
}
}
+
+ if nil != value.Template && nil != other.Template {
+ switch operator {
+ case FilterOperatorIsEqual:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return value.Template.Content == other.Template.Content
+ case FilterOperatorIsNotEqual:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return value.Template.Content != other.Template.Content
+ case FilterOperatorIsGreater:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return value.Template.Content > other.Template.Content
+ case FilterOperatorIsGreaterOrEqual:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return value.Template.Content >= other.Template.Content
+ case FilterOperatorIsLess:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return value.Template.Content < other.Template.Content
+ case FilterOperatorIsLessOrEqual:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return value.Template.Content <= other.Template.Content
+ case FilterOperatorContains:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return strings.Contains(value.Template.Content, other.Template.Content)
+ case FilterOperatorDoesNotContain:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return !strings.Contains(value.Template.Content, other.Template.Content)
+ case FilterOperatorStartsWith:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return strings.HasPrefix(value.Template.Content, other.Template.Content)
+ case FilterOperatorEndsWith:
+ if "" == strings.TrimSpace(other.Template.Content) {
+ return true
+ }
+ return strings.HasSuffix(value.Template.Content, other.Template.Content)
+ case FilterOperatorIsEmpty:
+ return "" == strings.TrimSpace(value.Template.Content)
+ case FilterOperatorIsNotEmpty:
+ return "" != strings.TrimSpace(value.Template.Content)
+ }
+ }
return true
}