diff --git a/src/index/index.lisp b/src/index/index.lisp index 8e147c6..6a29f00 100644 --- a/src/index/index.lisp +++ b/src/index/index.lisp @@ -351,18 +351,19 @@ (num-docs (reader self))) (defmethod add-indexes ((self index) &rest indexes) - (when (> (length indexes) 0) - (when (typep (elt indexes 0) 'index) - (setf indexes (map 'vector #'reader indexes))) - (cond ((typep (elt indexes 0) 'index-reader) - (let ((reader (reader self))) - (setf indexes (remove reader indexes))) - (add-indexes-readers (writer self) indexes)) - ((typep (elt indexes 0) 'directory) - (setf indexes (remove (slot-value self 'dir) indexes)) - (apply #'add-indexes (writer self) indexes)) - (T - (error "Unknown index type ~S when trying to merge indexes." (elt indexes 0)))))) + (let ((indexes indexes)) + (when (> (length indexes) 0) + (when (typep (elt indexes 0) 'index) + (setf indexes (map 'vector #'reader indexes))) + (cond ((typep (elt indexes 0) 'index-reader) + (let ((reader (reader self))) + (setf indexes (remove reader indexes))) + (add-indexes-readers (writer self) indexes)) + ((typep (elt indexes 0) 'directory) + (setf indexes (remove (slot-value self 'dir) indexes)) + (apply #'add-indexes (writer self) indexes)) + (T + (error "Unknown index type ~S when trying to merge indexes." (elt indexes 0))))))) (defgeneric persist (index directory &key create-p))