Skip to content

Instantly share code, notes, and snippets.

@zakwilson
Created June 20, 2011 23:22
Show Gist options
  • Save zakwilson/1036853 to your computer and use it in GitHub Desktop.
Save zakwilson/1036853 to your computer and use it in GitHub Desktop.
(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