(in-package :lisp-on-lines) (defmethod simple-word-search (class-name slots search-terms) (select class-name :where (simple-word-search-where class-name slots search-terms) :flatp t)) (defmethod simple-word-search-where (class-name slots search-terms) (sql-or (mapcar #'(lambda (term) (apply #'sql-or (mapcar #'(lambda (slot) (sql-uplike (sql-slot-value class-name slot) (format nil "%~a%" term))) slots))) search-terms))) (defmethod find-slots-of-type (model &key (type 'string) (types '((string)) types-supplied-p)) "returns a list of slots matching TYPE, or matching any of TYPES" (let (ty) (if types-supplied-p (setf ty types) (setf ty (list type))) (remove nil (mapcar #'(lambda (st) (when (member (second st) ty) (first st))) (list-slot-types model))))) ;;;; * Simple Search Component (defcomponent simple-search () ((search-term :initarg :search-term :accessor search-term :initform "") (listing :initarg :listing :accessor listing :initform :listing) (select-returns-p :initarg :select-returns-p :accessor select-returns-p :initform nil) (search-tables :initarg :search-tables :accessor search-tables :initform nil))) (defmethod render-on ((res response)(self simple-search)) (