         # File lib/ferret/index.rb, line 597
    597:     def add_indexes(indexes)
    598:       @dir.synchrolock do
    599:         ensure_writer_open()
    600:         indexes = [indexes].flatten   # make sure we have an array
    601:         return if indexes.size == 0 # nothing to do
    602:         if indexes[0].is_a?(Index)
    603:           indexes.delete(self) # don't merge with self
    604:           indexes = indexes.map {|index| index.reader }
    605:         elsif indexes[0].is_a?(Ferret::Store::Directory)
    606:           indexes.delete(@dir) # don't merge with self
    607:           indexes = indexes.map {|dir| IndexReader.new(dir) }
    608:         elsif indexes[0].is_a?(IndexReader)
    609:           indexes.delete(@reader) # don't merge with self
    610:         else
    611:           raise ArgumentError, "Unknown index type when trying to merge indexes"
    612:         end
    613:         ensure_writer_open
    614:         @writer.add_readers(indexes)
    615:       end
    616:     end