question: private boolean copyDocument ( SearchDocument newDocument , SearchDocument document , Map < String , Set < String > > removedProperties ) { boolean mutated = false ; for ( String oldFieldName : document . getPropertyNames ( ) ) { newDocument . addProperty ( oldFieldName ) ; List < String > oldValues = document . getProperty ( oldFieldName ) ; if ( oldValues != null ) { Set < String > objectsRemoved = ( removedProperties != null ) ? removedProperties . get ( oldFieldName ) : null ; for ( String oldValue : oldValues ) { if ( ( objectsRemoved != null ) && ( objectsRemoved . contains ( oldValue ) ) ) { mutated = true ; } else { addProperty ( oldFieldName , oldValue , newDocument ) ; } } } } return mutated ; }
target:  Creates a copy of the old document; updating the retrieved Document instance works ok for stored properties but indexed data gets lost when doing an IndexWriter.updateDocument with it.