Package org.neo4j.graphdb.index

Examples of org.neo4j.graphdb.index.IndexManager.forNodes()


    private void clearIndex(Map<String, Object> result) {
        IndexManager indexManager = graph.index();
        result.put("node-indexes", Arrays.asList(indexManager.nodeIndexNames()));
        result.put("relationship-indexes", Arrays.asList(indexManager.relationshipIndexNames()));
        for (String ix : indexManager.nodeIndexNames()) {
            indexManager.forNodes(ix).delete();
        }
        for (String ix : indexManager.relationshipIndexNames()) {
            indexManager.forRelationships(ix).delete();
        }
    }
View Full Code Here


    private static void clearIndex(GraphDatabaseService gds) {
        IndexManager indexManager = gds.index();
        for (String ix : indexManager.nodeIndexNames()) {
            try {
                Index<Node> nodeIndex = indexManager.forNodes(ix);
                if (nodeIndex.isWriteable()) nodeIndex.delete();
            } catch(Exception e) {
                log.warn("Cannot delete node index "+ix+" "+e.getMessage());
            }
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public <T extends PropertyContainer> Index<T> getIndex(String indexName) {
        IndexManager indexManager = delegate.index();
        if (indexManager.existsForNodes(indexName)) return (Index<T>) indexManager.forNodes(indexName);
        if (indexManager.existsForRelationships(indexName)) return (Index<T>) indexManager.forRelationships(indexName);
        throw new NoSuchIndexException(indexName);
    }

    // TODO handle existing indexes
View Full Code Here

        Transaction tx = delegate.beginTx();
        try {
            IndexManager indexManager = delegate.index();
            if (isNode(type)) {
                if (indexManager.existsForNodes(indexName))
                    return (Index<T>) checkAndGetExistingIndex(indexName, indexType, indexManager.forNodes(indexName));
                Index<Node> index = indexManager.forNodes(indexName, indexConfigFor(indexType));
                return (Index<T>) index;
            } else {
                if (indexManager.existsForRelationships(indexName))
                    return (Index<T>) checkAndGetExistingIndex(indexName, indexType, indexManager.forRelationships(indexName));
View Full Code Here

        try {
            IndexManager indexManager = delegate.index();
            if (isNode(type)) {
                if (indexManager.existsForNodes(indexName))
                    return (Index<T>) checkAndGetExistingIndex(indexName, indexType, indexManager.forNodes(indexName));
                Index<Node> index = indexManager.forNodes(indexName, indexConfigFor(indexType));
                return (Index<T>) index;
            } else {
                if (indexManager.existsForRelationships(indexName))
                    return (Index<T>) checkAndGetExistingIndex(indexName, indexType, indexManager.forRelationships(indexName));
                return (Index<T>) indexManager.forRelationships(indexName, indexConfigFor(indexType));
View Full Code Here

    }

    private void removeFromIndexes(Node node) {
        final IndexManager indexManager = delegate.index();
        for (String indexName : indexManager.nodeIndexNames()) {
            Index<Node> nodeIndex = indexManager.forNodes(indexName);
            if (nodeIndex.isWriteable()) nodeIndex.remove(node);
        }
    }

    private void removeFromIndexes(Relationship relationship) {
View Full Code Here

    private void clearIndex(Map<String, Object> result) {
        IndexManager indexManager = graph.index();
        result.put("node-indexes", Arrays.asList(indexManager.nodeIndexNames()));
        result.put("relationship-indexes", Arrays.asList(indexManager.relationshipIndexNames()));
        for (String ix : indexManager.nodeIndexNames()) {
            indexManager.forNodes(ix).delete();
        }
        for (String ix : indexManager.relationshipIndexNames()) {
            indexManager.forRelationships(ix).delete();
        }
    }
View Full Code Here

        Transaction transaction = graphDb.beginTx();
        try
        {
            // START SNIPPET: createIndices
            IndexManager index = graphDb.index();
            Index<Node> actors = index.forNodes( "actors" );
            Index<Node> movies = index.forNodes( "movies" );
            RelationshipIndex roles = index.forRelationships( "roles" );
            // END SNIPPET: createIndices

            // START SNIPPET: createNodes
View Full Code Here

        try
        {
            // START SNIPPET: createIndices
            IndexManager index = graphDb.index();
            Index<Node> actors = index.forNodes( "actors" );
            Index<Node> movies = index.forNodes( "movies" );
            RelationshipIndex roles = index.forRelationships( "roles" );
            // END SNIPPET: createIndices

            // START SNIPPET: createNodes
            // Actors
View Full Code Here

        Transaction transaction = graphDb.beginTx();
        try
        {
            // START SNIPPET: delete
            IndexManager index = graphDb.index();
            Index<Node> actors = index.forNodes( "actors" );
            actors.delete();
            // END SNIPPET: delete
            transaction.success();
        }
        finally
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.