Package org.neo4j.kernel

Examples of org.neo4j.kernel.EmbeddedGraphDatabase.index()


//    EmbeddedReadOnlyGraphDatabase graphDB = getReadOnlyGraphDatabase(servletContext);
    EmbeddedGraphDatabase graphDB = getGraphDatabase(servletContext);
    Index<Node> index = (Index<Node>)servletContext.getAttribute(SEARCH_IDX_GWT);
    if (index == null){
      IOHelper.log("Adding search index - " + SEARCH_IDX_GWT + "- to servletContext.");
      index = graphDB.index().forNodes(SEARCH_IDX_NEO4J,
          MapUtil.stringMap("analyzer", CustomTokenAnalyzer.class.getName())
          );
      ((LuceneIndex<Node>) index).setCacheCapacity("key", 300000);
      servletContext.setAttribute(SEARCH_IDX_GWT,index);
    }
View Full Code Here


//    EmbeddedReadOnlyGraphDatabase graphDB = getReadOnlyGraphDatabase(servletContext);
    EmbeddedGraphDatabase graphDB = getGraphDatabase(servletContext);
    Index<Node> index = (Index<Node>)servletContext.getAttribute(URI_IDX);
    if (index == null){
      IOHelper.log("Adding uri index - " + URI_IDX + " - to servletContext");
      index = graphDB.index().forNodes(URI_IDX);
      ((LuceneIndex<Node>) index).setCacheCapacity(DBNodeProperties.URI, 300000);
      servletContext.setAttribute(URI_IDX,index);
    }
    return index;
  }
View Full Code Here

        GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "target/graphdb-delete" );
        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();
        }
View Full Code Here

        }
        finally
        {
            transaction.finish();
        }
        assertFalse( graphDb.index().existsForNodes( "actors" ) );
        graphDb.shutdown();
    }

    @Test
    public void removeFromIndex()
View Full Code Here

    {
        GraphDatabaseService service = new EmbeddedGraphDatabase( "target/soquestion-test" );
        Transaction transaction = service.beginTx();
        try
        {
            RelationshipIndex index = service.index().forRelationships( "exact" );
            // ...creation of the nodes and relationship
            Node node1 = service.createNode();
            Node node2 = service.createNode();
            String a_uuid = "xyz";
            Relationship relationship = node1.createRelationshipTo( node2, DynamicRelationshipType.withName( "related" ) );
View Full Code Here

      Thread.sleep( 6000 );
      process.destroy();
      process.waitFor();
     
      GraphDatabaseService db = new EmbeddedGraphDatabase( path );
      assertTrue( db.index().existsForNodes( "myIndex" ) );
      Index<Node> index = db.index().forNodes( "myIndex" );
      for ( Node node : db.getAllNodes() )
      {
          for ( String key : node.getPropertyKeys() )
          {
View Full Code Here

      process.destroy();
      process.waitFor();
     
      GraphDatabaseService db = new EmbeddedGraphDatabase( path );
      assertTrue( db.index().existsForNodes( "myIndex" ) );
      Index<Node> index = db.index().forNodes( "myIndex" );
      for ( Node node : db.getAllNodes() )
      {
          for ( String key : node.getPropertyKeys() )
          {
              String value = (String) node.getProperty( key );
View Full Code Here

    public void testStartupInExistingDirectory() {
    File dir = new File("target" + File.separator + "temp" + File.separator);
        Neo4jTestCase.deleteFileOrDirectory( dir );
        dir.mkdir();
        EmbeddedGraphDatabase graphDatabase = new EmbeddedGraphDatabase( dir.getAbsolutePath() );
        Index<Node> index = graphDatabase.index().forNodes("nodes");
        assertNotNull(index);
    }

    @Test
    public void makeSureAdditionsCanBeReadNodeExact()
View Full Code Here

public class AddDeleteQuit
{
    public static void main( String[] args )
    {
        GraphDatabaseService db = new EmbeddedGraphDatabase( args[0] );
        Index<Node> index = db.index().forNodes( "index" );
        Transaction tx = db.beginTx();
        try
        {
            Node node = db.createNode();
            index.add( node, "key", "value" );
View Full Code Here

    public static void main( String[] args )
    {
        String path = args[0];
        String indexName = "myIndex";
        GraphDatabaseService db = new EmbeddedGraphDatabase( path );
        Index<Relationship> index = db.index().forRelationships( indexName );
        Transaction tx = db.beginTx();
        Node node = db.createNode();
        Relationship relationship = db.getReferenceNode().createRelationshipTo( node, DynamicRelationshipType.withName( "KNOWS" ) );
        index.add( relationship, "key", "value" );
        tx.success();
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.