basdenooijer/solarium — pull request #296 by shieldo (2014-11-25 15:27:55+00:00)
Title: only check type for added documents to add query if provided as an array

The purpose of adding support for traversables was so that it enabled large numbers of documents to be added in a manner that was as light as possible. Checking for the type of documents means that the traversable is evaluated, doing any work that happens at this point. As any update that is given bad data will fail anyway, I'd argue the type check should only be retained when arrays of documents are passed in, passing the responsibility of ensuring documents only are passed in away from the library (when traversables are used) - otherwise it almost defeats the purpose of supporting a traversable.