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;
}

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 ; }
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 .
