@Override public NodeExplicitIndexCursor allocateNodeExplicitIndexCursor() { NodeExplicitIndexCursor n = cursors.allocateNodeExplicitIndexCursor(); allCursors.add( n ); return n; }
@Override public IndexHits<Node> get( KernelTransaction ktx, String name, String key, Object value, GraphDatabaseService graphDatabaseService ) throws ExplicitIndexNotFoundKernelException { NodeExplicitIndexCursor cursor = ktx.cursors().allocateNodeExplicitIndexCursor(); ktx.indexRead().nodeExplicitIndexLookup( cursor, name, key, value ); return new CursorWrappingNodeIndexHits( cursor, graphDatabaseService, ktx, name ); }
@Override public IndexHits<Node> query( KernelTransaction ktx, String name, Object queryOrQueryObject, GraphDatabaseService graphDatabaseService ) throws ExplicitIndexNotFoundKernelException { NodeExplicitIndexCursor cursor = ktx.cursors().allocateNodeExplicitIndexCursor(); ktx.indexRead().nodeExplicitIndexQuery( cursor, name, queryOrQueryObject ); return new CursorWrappingNodeIndexHits( cursor, graphDatabaseService, ktx, name ); }
@Override public IndexHits<Node> query( KernelTransaction ktx, String name, String key, Object queryOrQueryObject, GraphDatabaseService graphDatabaseService ) throws ExplicitIndexNotFoundKernelException { NodeExplicitIndexCursor cursor = ktx.cursors().allocateNodeExplicitIndexCursor(); ktx.indexRead().nodeExplicitIndexQuery( cursor, name, key, queryOrQueryObject ); return new CursorWrappingNodeIndexHits( cursor, graphDatabaseService, ktx, name ); }
@Deprecated @Description( "Search nodes in explicit automatic index. Replaces `START n=node:node_auto_index('key:foo*')`" ) @Procedure( name = "db.index.explicit.auto.searchNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<WeightedNodeResult> nodeAutoIndexSearch( @Name( "query" ) Object query ) { try ( Statement ignore = tx.acquireStatement() ) { NodeExplicitIndexCursor cursor = tx.cursors().allocateNodeExplicitIndexCursor(); tx.indexRead().nodeExplicitIndexQuery( cursor, "node_auto_index", query ); return toWeightedNodeResultStream( cursor ); } catch ( KernelException e ) { // auto index will not exist if no nodes have been added that match the auto-index rules return Stream.empty(); } }
@Deprecated @Description( "Get node from explicit automatic index. Replaces `START n=node:node_auto_index(key = 'A')`" ) @Procedure( name = "db.index.explicit.auto.seekNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<NodeResult> nodeAutoIndexSeek( @Name( "key" ) String key, @Name( "value" ) Object value ) { try ( Statement ignore = tx.acquireStatement() ) { NodeExplicitIndexCursor cursor = tx.cursors().allocateNodeExplicitIndexCursor(); tx.indexRead().nodeExplicitIndexLookup( cursor, "node_auto_index", key, value ); return toStream( cursor, id -> new NodeResult( graphDatabaseAPI.getNodeById( id ) ) ); } catch ( KernelException e ) { // auto index will not exist if no nodes have been added that match the auto-index rules return Stream.empty(); } }
@Deprecated @Description( "Search nodes in explicit index. Replaces `START n=node:nodes('key:foo*')`" ) @Procedure( name = "db.index.explicit.searchNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<WeightedNodeResult> nodeManualIndexSearch( @Name( "indexName" ) String manualIndexName, @Name( "query" ) Object query ) throws ProcedureException { try ( Statement ignore = tx.acquireStatement() ) { NodeExplicitIndexCursor cursor = tx.cursors().allocateNodeExplicitIndexCursor(); tx.indexRead().nodeExplicitIndexQuery( cursor, manualIndexName, query ); return toWeightedNodeResultStream( cursor ); } catch ( KernelException e ) { throw new ProcedureException( Status.LegacyIndex.LegacyIndexNotFound, "Node index %s not found", manualIndexName ); } }
@Deprecated @Description( "Get node from explicit index. Replaces `START n=node:nodes(key = 'A')`" ) @Procedure( name = "db.index.explicit.seekNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<NodeResult> nodeManualIndexSeek( @Name( "indexName" ) String explicitIndexName, @Name( "key" ) String key, @Name( "value" ) Object value ) throws ProcedureException { try ( Statement ignore = tx.acquireStatement() ) { NodeExplicitIndexCursor cursor = tx.cursors().allocateNodeExplicitIndexCursor(); tx.indexRead().nodeExplicitIndexLookup( cursor, explicitIndexName, key, value ); return toStream( cursor, id -> new NodeResult( graphDatabaseAPI.getNodeById( id ) ) ); } catch ( KernelException e ) { throw new ProcedureException( Status.LegacyIndex.LegacyIndexNotFound, "Node index %s not found", explicitIndexName ); } }
@Override public IndexHits<Node> get( KernelTransaction ktx, String name, String key, Object value, GraphDatabaseService graphDatabaseService ) throws ExplicitIndexNotFoundKernelException { NodeExplicitIndexCursor cursor = ktx.cursors().allocateNodeExplicitIndexCursor(); ktx.indexRead().nodeExplicitIndexLookup( cursor, name, key, value ); return new CursorWrappingNodeIndexHits( cursor, graphDatabaseService, ktx, name ); }
@Override public IndexHits<Node> query( KernelTransaction ktx, String name, String key, Object queryOrQueryObject, GraphDatabaseService graphDatabaseService ) throws ExplicitIndexNotFoundKernelException { NodeExplicitIndexCursor cursor = ktx.cursors().allocateNodeExplicitIndexCursor(); ktx.indexRead().nodeExplicitIndexQuery( cursor, name, key, queryOrQueryObject ); return new CursorWrappingNodeIndexHits( cursor, graphDatabaseService, ktx, name ); }
@Override public IndexHits<Node> query( KernelTransaction ktx, String name, Object queryOrQueryObject, GraphDatabaseService graphDatabaseService ) throws ExplicitIndexNotFoundKernelException { NodeExplicitIndexCursor cursor = ktx.cursors().allocateNodeExplicitIndexCursor(); ktx.indexRead().nodeExplicitIndexQuery( cursor, name, queryOrQueryObject ); return new CursorWrappingNodeIndexHits( cursor, graphDatabaseService, ktx, name ); }
@Deprecated @Description( "Search nodes in explicit automatic index. Replaces `START n=node:node_auto_index('key:foo*')`" ) @Procedure( name = "db.index.explicit.auto.searchNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<WeightedNodeResult> nodeAutoIndexSearch( @Name( "query" ) Object query ) { try ( Statement ignore = tx.acquireStatement() ) { NodeExplicitIndexCursor cursor = tx.cursors().allocateNodeExplicitIndexCursor(); tx.indexRead().nodeExplicitIndexQuery( cursor, "node_auto_index", query ); return toWeightedNodeResultStream( cursor ); } catch ( KernelException e ) { // auto index will not exist if no nodes have been added that match the auto-index rules return Stream.empty(); } }
@Deprecated @Description( "Get node from explicit automatic index. Replaces `START n=node:node_auto_index(key = 'A')`" ) @Procedure( name = "db.index.explicit.auto.seekNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<NodeResult> nodeAutoIndexSeek( @Name( "key" ) String key, @Name( "value" ) Object value ) { try ( Statement ignore = tx.acquireStatement() ) { NodeExplicitIndexCursor cursor = tx.cursors().allocateNodeExplicitIndexCursor(); tx.indexRead().nodeExplicitIndexLookup( cursor, "node_auto_index", key, value ); return toStream( cursor, id -> new NodeResult( graphDatabaseAPI.getNodeById( id ) ) ); } catch ( KernelException e ) { // auto index will not exist if no nodes have been added that match the auto-index rules return Stream.empty(); } }
@Deprecated @Description( "Search nodes in explicit index. Replaces `START n=node:nodes('key:foo*')`" ) @Procedure( name = "db.index.explicit.searchNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<WeightedNodeResult> nodeManualIndexSearch( @Name( "indexName" ) String manualIndexName, @Name( "query" ) Object query ) throws ProcedureException { try ( Statement ignore = tx.acquireStatement() ) { NodeExplicitIndexCursor cursor = tx.cursors().allocateNodeExplicitIndexCursor(); tx.indexRead().nodeExplicitIndexQuery( cursor, manualIndexName, query ); return toWeightedNodeResultStream( cursor ); } catch ( KernelException e ) { throw new ProcedureException( Status.LegacyIndex.LegacyIndexNotFound, "Node index %s not found", manualIndexName ); } }
@Deprecated @Description( "Get node from explicit index. Replaces `START n=node:nodes(key = 'A')`" ) @Procedure( name = "db.index.explicit.seekNodes", mode = READ, deprecatedBy = EXPLICIT_INDEX_DEPRECATION ) public Stream<NodeResult> nodeManualIndexSeek( @Name( "indexName" ) String explicitIndexName, @Name( "key" ) String key, @Name( "value" ) Object value ) throws ProcedureException { try ( Statement ignore = tx.acquireStatement() ) { NodeExplicitIndexCursor cursor = tx.cursors().allocateNodeExplicitIndexCursor(); tx.indexRead().nodeExplicitIndexLookup( cursor, explicitIndexName, key, value ); return toStream( cursor, id -> new NodeResult( graphDatabaseAPI.getNodeById( id ) ) ); } catch ( KernelException e ) { throw new ProcedureException( Status.LegacyIndex.LegacyIndexNotFound, "Node index %s not found", explicitIndexName ); } }