Package org.neo4j.graphdb.index

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


    public void testCreateFulltextIndex() {
        Map<String,String> config=new HashMap<String, String>();
        config.put("provider", "lucene");
        config.put("type","fulltext");
        final IndexManager indexManager = getRestGraphDb().index();
        final Index<Node> index = indexManager.forNodes("fulltext", config);
        final Map<String, String> config2 = indexManager.getConfiguration(index);
        Assert.assertEquals("provider", config.get("provider"), config2.get("provider"));
        Assert.assertEquals("type", config.get("type"), config2.get("type"));
    }
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()) {
            deleteIndex(indexManager.forNodes(ix));
        }
        for (String ix : indexManager.relationshipIndexNames()) {
            deleteIndex(indexManager.forRelationships(ix));
        }
    }
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

                 referenceNode = this.graphDb.createNode();
             }

             //create the index for all characters that are considered good guys (sorry cypher)
             IndexManager index = this.graphDb.index();
             Index<Node> goodGuys = index.forNodes("heroes");
             //create persons collection node
             Node persons = this.graphDb.createNode();
             persons.setProperty("type", "Persons Collection");
             //create heroes collection node
             Node heroes = this.graphDb.createNode();
View Full Code Here

  }
 
  @Test
  public void testGetIndexByIndexForNodesCreationViaRestAPI(){
    IndexManager index = getRestGraphDb().index();
      Index<Node> testIndex = index.forNodes("indexName");
      Assert.assertEquals(testIndex.getName(), this.restAPI.getIndex("indexName").getName());
  }
 
  @Test
  public void testCreateRestAPIIndexForRelationship(){
View Full Code Here

      }
   
    @Test
      public void useTrinityIndex() throws Exception {
        IndexManager index = getRestGraphDb().index();            
        Index<Node> goodGuys = index.forNodes("heroes");
        IndexHits<Node> hits = goodGuys.get( "name", "Trinity" );
        Node trinity = hits.getSingle();
        assertEquals( "Trinity", trinity.getProperty("name") );
      }
     
View Full Code Here

      }
     
      @Test
      public void useMorpheusQuery() throws Exception {
        IndexManager index = getRestGraphDb().index();            
        Index<Node> goodGuys = index.forNodes("heroes");
        for (Node morpheus : goodGuys.query("name", "Morpheus")){
          assertEquals( "Morpheus", morpheus.getProperty("name") );
        }
      }
     
View Full Code Here

           }
          
           @Test
           public void useMorpheusQuery() throws Exception {
             IndexManager index = graphDb.index();            
             Index<Node> goodGuys = index.forNodes("heroes");
             for (Node morpheus : goodGuys.query("name", "Morpheus")){
               assertEquals( "Morpheus", morpheus.getProperty("name") );
             }
           }
          
View Full Code Here

           }
          
           @Test
           public void useTrinityIndex() throws Exception {
             IndexManager index = graphDb.index();            
             Index<Node> goodGuys = index.forNodes("heroes");
             IndexHits<Node> hits = goodGuys.get( "name", "Trinity" );
             Node trinity = hits.getSingle();
             assertEquals( "Trinity", trinity.getProperty("name") );
           }
          
View Full Code Here

           }
          
           @Test
           public void compareIndexAndTraversal() throws Exception {
             IndexManager index = graphDb.index();            
             Index<Node> goodGuys = index.forNodes("heroes");
             IndexHits<Node> hits = goodGuys.query( "name", "*" );           
             Traverser heroesTraverser = getHeroes();              
               assertEquals( heroesTraverser.nodes().iterator().next().getId(), hits.iterator().next().getId() );
           }
          
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.