void addDocuments ( final Document [ ] docs ) throws IOException { final IndexWriter writer = getIndexWriter ( ) ; IOException ioExc = null ; try { for ( Document doc : docs ) { try { writer . addDocument ( doc ) ; } catch ( Throwable e ) //NOSONAR { if ( ioExc == null ) { if ( e instanceof IOException ) { ioExc = ( IOException ) e ; } else { ioExc = Util . createIOException ( e ) ; } } log . warn ( "Exception while inverting document" , e ) ; } } } finally { invalidateSharedReader ( ) ; } if ( ioExc != null ) { throw ioExc ; } }
Adds documents to this index and invalidates the shared reader .