浏览代码

:art: Update av https://github.com/siyuan-note/insider/issues/1117

Daniel 2 年之前
父节点
当前提交
6d59de2577
共有 1 个文件被更改,包括 25 次插入0 次删除
  1. 25 0
      kernel/av/table.go

+ 25 - 0
kernel/av/table.go

@@ -123,6 +123,9 @@ func (value *Value) Compare(other *Value) int {
 		}
 		}
 		return strings.Compare(v1, v2)
 		return strings.Compare(v1, v2)
 	}
 	}
+	if nil != value.URL && nil != other.URL {
+		return strings.Compare(value.URL.Content, other.URL.Content)
+	}
 	return 0
 	return 0
 }
 }
 
 
@@ -238,6 +241,28 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) bool
 			return 0 != len(value.MSelect) && !(1 == len(value.MSelect) && "" == value.MSelect[0].Content)
 			return 0 != len(value.MSelect) && !(1 == len(value.MSelect) && "" == value.MSelect[0].Content)
 		}
 		}
 	}
 	}
+
+	if nil != value.URL && nil != other.URL {
+		switch operator {
+		case FilterOperatorIsEqual:
+			return value.URL.Content == other.URL.Content
+		case FilterOperatorIsNotEqual:
+			return value.URL.Content != other.URL.Content
+		case FilterOperatorContains:
+			return strings.Contains(value.URL.Content, other.URL.Content)
+		case FilterOperatorDoesNotContain:
+			return !strings.Contains(value.URL.Content, other.URL.Content)
+		case FilterOperatorStartsWith:
+			return strings.HasPrefix(value.URL.Content, other.URL.Content)
+		case FilterOperatorEndsWith:
+			return strings.HasSuffix(value.URL.Content, other.URL.Content)
+		case FilterOperatorIsEmpty:
+			return "" == strings.TrimSpace(value.URL.Content)
+		case FilterOperatorIsNotEmpty:
+			return "" != strings.TrimSpace(value.URL.Content)
+		}
+	}
+
 	return true
 	return true
 }
 }