// Path: src/main/java/org/neo4j/index/impl/lucene/CommitContext.java
// static class DocumentContext
// {
//     final Document document;
//     final boolean exists;
//     final long entityId;
// 
//     DocumentContext( Document document, boolean exists, long entityId )
//     {
//         this.document = document;
//         this.exists = exists;
//         this.entityId = entityId;
//     }
// }


import org.neo4j.kernel.impl.transaction.xaframework.XaCommand;
import org.neo4j.kernel.impl.util.IoPrimitiveUtils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.util.HashMap;
import java.util.Map;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.PropertyContainer;
import org.neo4j.graphdb.Relationship;
import org.neo4j.index.impl.lucene.CommitContext.DocumentContext;
import org.neo4j.kernel.impl.transaction.xaframework.LogBuffer;
            context.ensureWriterInstantiated();
            context.indexType.addToDocument( context.getDocument( entityId, true ).document, key, value );
            context.dataSource.invalidateCache( context.identifier, key, value );
        }
        
        @Override
        public boolean isConsideredNormalWriteCommand()
        {
            return true;
        }

        @Override
        public String toString()
        {
            RelationshipId relId = (RelationshipId)entityId;
            return "AddRel[" + indexId + "," + relId.id + "," + key + "," + value + "," + relId.startNode + "," + relId.endNode + "]";
        }
    }
    
    static class RemoveCommand extends LuceneCommand
    {
        RemoveCommand( IndexIdentifier indexId, byte entityType, Object entityId, String key, Object value )
        {
            super( indexId, entityType, entityId, key, value, REMOVE_COMMAND );
        }
        
        @Override
        void perform( CommitContext context )
        {
            context.ensureWriterInstantiated();
// Path: src/main/java/org/neo4j/index/impl/lucene/CommitContext.java
// static class DocumentContext
// {
//     final Document document;
//     final boolean exists;
//     final long entityId;
// 
//     DocumentContext( Document document, boolean exists, long entityId )
//     {
//         this.document = document;
//         this.exists = exists;
//         this.entityId = entityId;
//     }
// }


// Path: src/main/java/org/neo4j/index/impl/lucene/LuceneCommand.java
import org.neo4j.kernel.impl.transaction.xaframework.XaCommand;
import org.neo4j.kernel.impl.util.IoPrimitiveUtils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.util.HashMap;
import java.util.Map;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.PropertyContainer;
import org.neo4j.graphdb.Relationship;
import org.neo4j.index.impl.lucene.CommitContext.DocumentContext;
import org.neo4j.kernel.impl.transaction.xaframework.LogBuffer;

            context.ensureWriterInstantiated();
            context.indexType.addToDocument( context.getDocument( entityId, true ).document, key, value );
            context.dataSource.invalidateCache( context.identifier, key, value );
        }
        
        @Override
        public boolean isConsideredNormalWriteCommand()
        {
            return true;
        }

        @Override
        public String toString()
        {
            RelationshipId relId = (RelationshipId)entityId;
            return "AddRel[" + indexId + "," + relId.id + "," + key + "," + value + "," + relId.startNode + "," + relId.endNode + "]";
        }
    }
    
    static class RemoveCommand extends LuceneCommand
    {
        RemoveCommand( IndexIdentifier indexId, byte entityType, Object entityId, String key, Object value )
        {
            super( indexId, entityType, entityId, key, value, REMOVE_COMMAND );
        }
        
        @Override
        void perform( CommitContext context )
        {
            context.ensureWriterInstantiated();
            DocumentContext document = context.getDocument( entityId, false );