Package org.neo4j.graphdb.index

Examples of org.neo4j.graphdb.index.IndexManager


    @Test
    public void fulltext()
    {
        // START SNIPPET: fulltext
        IndexManager index = graphDb.index();
        Index<Node> fulltextMovies = index.forNodes( "movies-fulltext",
                MapUtil.stringMap( "provider", "lucene", "type", "fulltext" ) );
        // END SNIPPET: fulltext

        Index<Node> movies = index.forNodes( "movies" );
        Node theMatrix = movies.get( "title", "The Matrix" ).getSingle();
        Node theMatrixReloaded = movies.get( "title", "The Matrix Reloaded" ).getSingle();

        // START SNIPPET: fulltext
        fulltextMovies.add( theMatrix, "title", "The Matrix" );
View Full Code Here


        inserter.shutdown();
        GraphDatabaseService graphDb = new EmbeddedGraphDatabase( path );
        Transaction tx = graphDb.beginTx();
        try
        {
            IndexManager indexManager = graphDb.index();
            Assert.assertFalse( indexManager.existsForRelationships( indexName ) );
            Assert.assertTrue( indexManager.existsForNodes( indexName ) );
            Assert.assertNotNull( indexManager.forNodes( indexName ) );
            Index<Node> nodes = graphDb.index().forNodes( indexName );
            Assert.assertTrue( nodes.get( "name", "test" ).hasNext() );
            tx.success();
            tx.finish();
        }
View Full Code Here

    private Iterable<PropertyContainer> getMatchingNodesFromIndices( final IProgressMonitor monitor,
            final GraphDatabaseService graphDb )
    {
        List<PropertyContainer> matches = new LinkedList<PropertyContainer>();
        IndexManager indexManager = graphDb.index();
        for ( String indexName : search.getNodeIndexNames() )
        {
            if ( !indexManager.existsForNodes( indexName ) )
            {
                continue;
            }
            Index<Node> nodeIndex = indexManager.forNodes( indexName );
            Iterable<Node> hits;
            switch ( search.getMode() )
            {
            case EXACT_MATCH:
                hits = nodeIndex.get( search.getKey(), search.getValueOrQuery() );
                break;
            case QUERY:
                String key = search.getKey();
                hits = nodeIndex.query( key, search.getValueOrQuery() );
                break;
            default:
                hits = null;
            }
            for ( Node hit : hits )
            {
                matches.add( hit );
            }
        }
        for ( String indexName : search.getRelationshipIndexNames() )
        {
            if ( !indexManager.existsForRelationships( indexName ) )
            {
                continue;
            }
            Index<Relationship> relIndex = indexManager.forRelationships( indexName );
            IndexHits<Relationship> hits;
            switch ( search.getMode() )
            {
            case EXACT_MATCH:
                hits = relIndex.get( search.getKey(), search.getValueOrQuery() );
View Full Code Here

    @Override
    protected Continuation exec(AppCommandParser parser, Session session, Output out) throws Exception {
        Type type = Type.valueOf(parser.option("t", "Node"));
        boolean remove = parser.options().containsKey("r");

        IndexManager index = getServer().getDb().index();
        AutoIndexer<? extends PropertyContainer> autoIndexer = type==Type.Node ? index.getNodeAutoIndexer() : index.getRelationshipAutoIndexer();
        autoIndexer.setEnabled(true);

        out.println((remove ? "Disabling" : "Enabling") + " auto-indexing of " + type + " properties: " + parser.arguments());
        for (String argument : parser.arguments()) {
            if (remove) {
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.index.IndexManager

Copyright © 2018 www.massapicom. 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.