@Deprecated @Override public IndexManager index() { return getGraphDatabaseAPI().index(); }
@Deprecated @Description( "Check if a relationship explicit index exists" ) @Procedure( name = "db.index.explicit.existsForRelationships", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<BooleanResult> relationshipManualIndexExists( @Name( "indexName" ) String explicitIndexName ) { return Stream.of( new BooleanResult( graphDatabaseAPI.index().existsForRelationships( explicitIndexName ) ) ); }
@Deprecated @Description( "Check if a node explicit index exists" ) @Procedure( name = "db.index.explicit.existsForNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<BooleanResult> nodeManualIndexExists( @Name( "indexName" ) String explicitIndexName ) { return Stream.of( new BooleanResult( graphDatabaseAPI.index().existsForNodes( explicitIndexName ) ) ); }
public boolean nodeIsIndexed( String indexName, String key, Object value, long nodeId ) { Index<Node> index = graphDb.index().forNodes( indexName ); Node expectedNode = graphDb.getNodeById( nodeId ); try ( IndexHits<Node> hits = index.get( key, value ) ) { return iterableContains( hits, expectedNode ); } }
public boolean relationshipIsIndexed( String indexName, String key, Object value, long relationshipId ) { Index<Relationship> index = graphDb.index().forRelationships( indexName ); Relationship expectedNode = graphDb.getRelationshipById( relationshipId ); try ( IndexHits<Relationship> hits = index.get( key, value ) ) { return iterableContains( hits, expectedNode ); } }
public Representation getAutoIndexedNodes( String key, String value ) { ReadableIndex<Node> index = graphDb.index().getNodeAutoIndexer().getAutoIndex(); return toListNodeRepresentation( index.get( key, value ), null ); }
public Representation getAutoIndexedRelationships( String key, String value ) { final ReadableIndex<Relationship> index = graphDb.index().getRelationshipAutoIndexer().getAutoIndex(); return toListRelationshipRepresentation( index.get( key, value ), null ); }
public ListRepresentation getAutoIndexedRelationshipsByQuery( String query ) { final ReadableIndex<Relationship> index = graphDb.index().getRelationshipAutoIndexer().getAutoIndex(); final IndexHits<Relationship> results = query != null ? index.query( query ) : null; return toListRelationshipRepresentation( results, null ); }
public IndexedEntityRepresentation addToRelationshipIndex( String indexName, String key, String value, long relationshipId ) { Relationship relationship = graphDb.getRelationshipById( relationshipId ); Index<Relationship> index = graphDb.index().forRelationships( indexName ); index.add( relationship, key, value ); return new IndexedEntityRepresentation( relationship, key, value, new RelationshipIndexRepresentation( indexName, Collections.emptyMap() ) ); }
public IndexedEntityRepresentation addToNodeIndex( String indexName, String key, String value, long nodeId ) { Node node = graphDb.getNodeById( nodeId ); Index<Node> index = graphDb.index().forNodes( indexName ); index.add( node, key, value ); return new IndexedEntityRepresentation( node, key, value, new NodeIndexRepresentation( indexName, Collections.emptyMap() ) ); }
@Deprecated @Description( "Add a relationship to an explicit index based on a specified key and value" ) @Procedure( name = "db.index.explicit.addRelationship", mode = WRITE, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<BooleanResult> relationshipManualIndexAdd( @Name( "indexName" ) String explicitIndexName, @Name( "relationship" ) Relationship relationship, @Name( "key" ) String key, @Name( "value" ) Object value ) { graphDatabaseAPI.index().forRelationships( explicitIndexName ).add( relationship, key, value ); // Failures will be expressed as exceptions before the return return Stream.of( new BooleanResult( Boolean.TRUE ) ); }
public ListRepresentation getAutoIndexedNodesByQuery( String query ) { if ( query != null ) { ReadableIndex<Node> index = graphDb.index().getNodeAutoIndexer().getAutoIndex(); return toListNodeRepresentation( index.query( query ), null ); } return toListNodeRepresentation(); }
private Index<Node> createNodeIndex( GraphDatabaseAPI db ) { try ( Transaction tx = db.beginTx() ) { Index<Node> index = db.index().forNodes( "test", stringMap( PROVIDER, IDENTIFIER ) ); tx.success(); return index; } }
@Test public void deprecatedStartNodeIndexSeek() { try ( Transaction ignore = db().beginTx() ) { db().index().forNodes( "index" ); } assertNotifications( "EXPLAIN START n=node:index(key = 'value') RETURN n", containsItem( deprecatedStartWarning ) ); }
@Test public void deprecatedStartRelIndexSearch() { try ( Transaction ignore = db().beginTx() ) { db().index().forRelationships( "index" ); } assertNotifications( "EXPLAIN START r=relationship:index('key:value*') RETURN r", containsItem( deprecatedStartWarning ) ); }
@Test public void deprecatedStartRelIndexSeek() { try ( Transaction ignore = db().beginTx() ) { db().index().forRelationships( "index" ); } assertNotifications( "EXPLAIN START r=relationship:index(key = 'value') RETURN r", containsItem( deprecatedStartWarning ) ); }
@Test public void deprecatedStartNodeIndexSearch() { try ( Transaction ignore = db().beginTx() ) { db().index().forNodes( "index" ); } assertNotifications( "EXPLAIN START n=node:index('key:value*') RETURN n", containsItem( deprecatedStartWarning ) ); }
@Test public void testDefaultIsOff() { newTransaction(); Node node1 = graphDb.createNode(); node1.setProperty( "testProp", "node1" ); newTransaction(); AutoIndexer<Node> autoIndexer = graphDb.index().getNodeAutoIndexer(); assertFalse( autoIndexer.getAutoIndex().get( "testProp", "node1" ).hasNext() ); }