         # File lib/ferret/index.rb, line 757
    757:     def add_indexes(indexes)
    758:       @dir.synchronize do
    759:         ensure_writer_open()
    760:         indexes = [indexes].flatten   # make sure we have an array
    761:         return if indexes.size == 0 # nothing to do
    762:         if indexes[0].is_a?(Index)
    763:           indexes.delete(self) # don't merge with self
    764:           indexes = indexes.map {|index| index.reader }
    765:         elsif indexes[0].is_a?(Ferret::Store::Directory)
    766:           indexes.delete(@dir) # don't merge with self
    767:           indexes = indexes.map {|dir| IndexReader.new(dir) }
    768:         elsif indexes[0].is_a?(IndexReader)
    769:           indexes.delete(@reader) # don't merge with self
    770:         else
    771:           raise ArgumentError, "Unknown index type when trying to merge indexes"
    772:         end
    773:         ensure_writer_open
    774:         @writer.add_readers(indexes)
    775:       end
    776:     end