Examples of BatchInserterImpl


Examples of org.neo4j.kernel.impl.batchinsert.BatchInserterImpl

    @Test
    public void testFindCreatedIndex()
    {
        String indexName = "persons";
        String path = new File( PATH, "4" ).getAbsolutePath();
        BatchInserter inserter = new BatchInserterImpl( path );
        LuceneBatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider(
                inserter );
        BatchInserterIndex persons = indexProvider.nodeIndex( "persons",
                stringMap( "type", "exact" ) );
        Map<String, Object> properties = map( "name", "test" );
        long node = inserter.createNode( properties );
        persons.add( node, properties );
        indexProvider.shutdown();
        inserter.shutdown();
        GraphDatabaseService graphDb = new EmbeddedGraphDatabase( path );
        Transaction tx = graphDb.beginTx();
        try
        {
            IndexManager indexManager = graphDb.index();
View Full Code Here

Examples of org.neo4j.kernel.impl.batchinsert.BatchInserterImpl

    }

    @Test
    public void testCanIndexRelationships()
    {
        BatchInserter inserter = new BatchInserterImpl( new File( PATH, "5" ).getAbsolutePath() );
        BatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider(
                inserter );
        BatchInserterIndex edgesIndex = indexProvider.relationshipIndex(
                "edgeIndex", stringMap( "provider", "lucene", "type", "exact" ) );

        long nodeId1 = inserter.createNode( map( "ID", "1" ) );
        long nodeId2 = inserter.createNode( map( "ID", "2" ) );
        long relationshipId = inserter.createRelationship( nodeId1, nodeId2,
                EdgeType.KNOWS, null );

        edgesIndex.add( relationshipId, map( "EDGE_TYPE", EdgeType.KNOWS.name() ) );
        edgesIndex.flush();

        assertEquals(
                String.format( "Should return relationship id" ),
                new Long( relationshipId ),
                edgesIndex.query( "EDGE_TYPE", EdgeType.KNOWS.name() ).getSingle() );

        indexProvider.shutdown();
        inserter.shutdown();
    }
View Full Code Here

Examples of org.neo4j.kernel.impl.batchinsert.BatchInserterImpl

    }
   
    @Test
    public void triggerNPEAfterFlush()
    {
        BatchInserter inserter = new BatchInserterImpl( new File( PATH, "6" ).getAbsolutePath() );
        BatchInserterIndexProvider provider = new LuceneBatchInserterIndexProvider( inserter );
        BatchInserterIndex index = provider.nodeIndex( "Node-exact", EXACT_CONFIG );
       
        Map<String, Object> map = map( "name", "Something" );
        long node = inserter.createNode( map );
        index.add( node, map );
        index.flush();
        assertContains( index.get( "name", "Something" ), node );
       
        provider.shutdown();
        inserter.shutdown();
    }
View Full Code Here

Examples of org.neo4j.kernel.impl.batchinsert.BatchInserterImpl

   
    @Test
    public void testNumericValues()
    {
        String path = new File( PATH, "7" ).getAbsolutePath();
        BatchInserter inserter = new BatchInserterImpl( path );
        BatchInserterIndexProvider provider = new LuceneBatchInserterIndexProvider(
                inserter );
        BatchInserterIndex index = provider.nodeIndex( "mine", EXACT_CONFIG );
       
        long node1 = inserter.createNode( null );
        index.add( node1, map( "number", numeric( 45 ) ) );
        long node2 = inserter.createNode( null );
        index.add( node2, map( "number", numeric( 21 ) ) );
        assertContains( index.query( "number",
                newIntRange( "number", 21, 50, true, true ) ), node1, node2 );
       
        provider.shutdown();
        inserter.shutdown();
       
        GraphDatabaseService db = new EmbeddedGraphDatabase( path );
        Node n1 = db.getNodeById( node1 );
        Node n2 = db.getNodeById( node2 );
        Index<Node> idx = db.index().forNodes( "mine" );
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.