         # File lib/ferret/index.rb, line 554
    554:     def add_indexes(indexes)
    555:       @dir.synchronize do
    556:         indexes = [indexes].flatten   # make sure we have an array
    557:         return if indexes.size == 0 # nothing to do
    558:         if indexes[0].is_a?(Index)
    559:           indexes.delete(self) # don't merge with self
    560:           indexes = indexes.map {|index| index.reader }
    561:         elsif indexes[0].is_a?(Ferret::Store::Directory)
    562:           indexes.delete(@dir) # don't merge with self
    563:           indexes = indexes.map {|dir| IndexReader.new(dir) }
    564:         elsif indexes[0].is_a?(IndexReader)
    565:           indexes.delete(@reader) # don't merge with self
    566:         else
    567:           raise ArgumentError, "Unknown index type when trying to merge indexes"
    568:         end
    569:         ensure_writer_open
    570:         @writer.add_readers(indexes)
    571:       end
    572:     end