[Enhanced get-instances-limit clinton@unknownlamer.org**20080107223930 limit is now a keyword argument and searching from the end is possible ] { hunk ./src/database.lisp 19 -(defgeneric get-instances-limit (class slot-name start end &optional limit)) +(defgeneric get-instances-limit (class slot-name start end &key limit from-end)) hunk ./src/database.lisp 21 -(defmethod get-instances-limit ((class symbol) slot-name start end &optional limit) - (get-instances-limit (find-class class) slot-name start end limit)) +(defmethod get-instances-limit ((class symbol) slot-name start end + &key limit from-end) + (get-instances-limit (find-class class) slot-name start end + :limit limit :from-end from-end)) hunk ./src/database.lisp 27 - &optional limit) - (if limit - (handler-case - (map-inverted-index (make-index-mapper #'elephant::identity2 limit) - class slot-name :start start :end end :collect t) - (results-limit-reached (c) (values (limit-result c) (limit-count c)))) - (get-instances-by-range class slot-name start end))) + &key limit from-end) + (let ((mapper (if limit + (make-index-mapper #'elephant::identity2 limit) + #'elephant::identity2))) + (handler-case + (map-inverted-index mapper + class + slot-name + :start start :end end + :collect t :from-end from-end) + (results-limit-reached (c) (values (limit-result c) (limit-count c)))))) }