Skip to content

Commit

Permalink
Support for adding relationship to explicit index
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed Feb 23, 2018
1 parent c7bf38b commit b9f1dcb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.internal.kernel.api;

import org.junit.Ignore;
import org.junit.Test;

import java.util.HashMap;
Expand Down Expand Up @@ -265,7 +264,7 @@ public void shouldCreateExplicitIndexTwice() throws Exception
}

//TODO unignore when we support relationship creation.
@Ignore
@Test
public void shouldAddRelationshipToExplicitIndex() throws Exception
{
long relId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,19 @@ public void nodeExplicitIndexCreateLazily( String indexName, Map<String,String>

@Override
public void relationshipAddToExplicitIndex( String indexName, long relationship, String key, Object value )
throws KernelException
{
throw new UnsupportedOperationException( );
ktx.assertOpen();
allStoreHolder.singleRelationship( relationship, relationshipCursor );
if ( relationshipCursor.next() )
{
ktx.explicitIndexTxState().relationshipChanges( indexName ).addRelationship( relationship, key, value,
relationshipCursor.sourceNodeReference(), relationshipCursor.targetNodeReference() ) ;
}
else
{
throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationship );
}
}

@Override
Expand Down

0 comments on commit b9f1dcb

Please sign in to comment.