예제 #1
0
 private static RelationshipIndex RelationshipIndex(GraphDatabaseService db, string name, IDictionary <string, string> config)
 {
     using (Transaction tx = Db.beginTx())
     {
         RelationshipIndex index = Db.index().forRelationships(name, config);
         tx.Success();
         return(index);
     }
 }
예제 #2
0
 public virtual Index <Relationship> CreateRelationshipIndex(string named)
 {
     using (Transaction transaction = _database.Graph.beginTransaction(@implicit, AUTH_DISABLED))
     {
         RelationshipIndex relationshipIndex = _database.Graph.index().forRelationships(named);
         transaction.Success();
         return(relationshipIndex);
     }
 }
예제 #3
0
 private TimelineIndex <PropertyContainer> RelationshipTimeline()
 {
     using (Transaction tx = _db.beginTx())
     {
         RelationshipIndex relationshipIndex = _db.index().forRelationships("timeline");
         tx.Success();
         return(new LuceneTimeline(_db, relationshipIndex));
     }
 }
예제 #4
0
        public override RelationshipIndex ForRelationships(string indexName, IDictionary <string, string> customConfiguration)
        {
            RelationshipIndex toReturn = _provider.getOrCreateRelationshipIndex(indexName, customConfiguration);

            // TODO move this into kernel layer
            if (InternalAutoIndexing.RELATIONSHIP_AUTO_INDEX.Equals(indexName))
            {
                return(new RelationshipReadOnlyIndexFacade(toReturn));
            }
            return(toReturn);
        }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGettingAutoIndexByNameReturnsSomethingReadOnly()
        public virtual void TestGettingAutoIndexByNameReturnsSomethingReadOnly()
        {
            // Create the node and relationship auto-indexes
            NewTransaction();
            _graphDb.index().NodeAutoIndexer.Enabled = true;
            _graphDb.index().NodeAutoIndexer.startAutoIndexingProperty("nodeProp");
            _graphDb.index().RelationshipAutoIndexer.Enabled = true;
            _graphDb.index().RelationshipAutoIndexer.startAutoIndexingProperty("relProp");

            Node         node1 = _graphDb.createNode();
            Node         node2 = _graphDb.createNode();
            Relationship rel   = node1.CreateRelationshipTo(node2, RelationshipType.withName("FOO"));

            node1.SetProperty("nodeProp", "nodePropValue");
            rel.SetProperty("relProp", "relPropValue");

            NewTransaction();

            assertEquals(1, _graphDb.index().nodeIndexNames().length);
            assertEquals(1, _graphDb.index().relationshipIndexNames().length);

            assertEquals("node_auto_index", _graphDb.index().nodeIndexNames()[0]);
            assertEquals("relationship_auto_index", _graphDb.index().relationshipIndexNames()[0]);

            Index <Node>      nodeIndex = _graphDb.index().forNodes("node_auto_index");
            RelationshipIndex relIndex  = _graphDb.index().forRelationships("relationship_auto_index");

            assertEquals(node1, nodeIndex.get("nodeProp", "nodePropValue").Single);
            assertEquals(rel, relIndex.get("relProp", "relPropValue").Single);
            try
            {
                nodeIndex.Add(null, null, null);
                fail("Auto indexes should not allow external manipulation");
            }
            catch (System.NotSupportedException)
            {               // good
            }

            try
            {
                relIndex.add(null, null, null);
                fail("Auto indexes should not allow external manipulation");
            }
            catch (System.NotSupportedException)
            {               // good
            }
        }