Created
June 20, 2011 23:22
-
-
Save zakwilson/1036853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn search-items [terms & [cat]] | |
(let [terms-seq (map sql-wildcard | |
(s/split terms #"[ \t]+"))] | |
(select (if cat | |
(items-by-cat cat) | |
items) | |
(where (or (apply or (map (partial ilike :longdesc) terms-seq)) | |
(apply or (map (partial ilike :shortdesc) terms-seq))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment