+(defgeneric expr-ends-with (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-starts-with (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-contains (instance slot-name value)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-and (instance &rest args)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-or (instance &rest args)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric expr-not (instance &rest args)
+ (:documentation "Create search expression for appropriate backend."))
+
+(defgeneric select-instances (instance &rest args)
+ (:documentation "Select instances in backend dependent way"))
+
+(defmacro def-compare-expr (instance-type name expr &key value-format)
+ `(defmethod ,name ((instance ,instance-type) slot-name value)
+ (declare (ignore instance))
+ (,expr slot-name ,(typecase value-format
+ (null 'value)
+ (string `(format nil ,value-format value))
+ (t `(,value-format value))))))
+
+(defmacro def-logical-expr (instance-type name expr)
+ `(defmethod ,name ((instance ,instance-type) &rest args)
+ (declare (ignore instance))
+ (apply ,expr args)))
\ No newline at end of file