Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(index.lisp) add-indexes: Ensure (safety 3) #9

Merged
merged 1 commit into from
Jun 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions src/index/index.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down