From: Maciej Pasternacki Date: Thu, 18 Dec 2008 00:19:59 +0000 (+0100) Subject: - Fix TERM-SYNONYMS. X-Git-Url: https://repo.or.cz/w/cl-trane.git/commitdiff_plain/ec6608282cd425f734894cbf27e4c67113d9b312 - Fix TERM-SYNONYMS. --- diff --git a/src/taxonomy.lisp b/src/taxonomy.lisp index 644d6b7..f6a98ac 100644 --- a/src/taxonomy.lisp +++ b/src/taxonomy.lisp @@ -287,17 +287,23 @@ TERM is always included in the returned list, and it is a first item. TERM may be also a list, whose first element is taxonomy object or name, and second element is term name. This is a case of premature optimization." - (query-dao 'term - (sql (:select '* :from 'term - :where (:and (:= 'term-taxonomy - (taxonomy-slug - (etypecase term - (term (term-taxonomy term)) - (list (first term))))) - (:= (:lower 'term-text) - (:lower (etypecase term - (term (term-text term)) - (list (string (second term))))))))))) + (etypecase term + (term (cons term + (mapcar #'cache-dao + (query-dao 'term + (sql (:select '* :from 'term + :where (:and (:!= 'term-id (id term)) + (:= 'term-taxonomy + (taxonomy-slug (term-taxonomy term))) + (:= (:lower 'term-text) + (:lower (term-text term)))))))))) + (list (mapcar #'cache-dao + (query-dao 'term + (sql (:select '* :from 'term + :where (:and (:= 'term-taxonomy + (taxonomy-slug (first term))) + (:= (:lower 'term-text) + (:lower (string (second term)))))))))))) (defun apply-term (item term &key value order) "Apply TERM to ITEM, optionally setting its value to VALUE."