//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private long addNodeToExplicitIndex() throws Exception
        private long AddNodeToExplicitIndex()
        {
            long nodeId;

            using (Transaction tx = beginTransaction())
            {
                nodeId = tx.DataWrite().nodeCreate();
                ExplicitIndexWrite          indexWrite = tx.IndexWrite();
                Dictionary <string, string> config     = new Dictionary <string, string>();
                config["type"]     = "exact";
                config["provider"] = "lucene";
                indexWrite.NodeExplicitIndexCreateLazily(INDEX_NAME, config);
                indexWrite.NodeAddToExplicitIndex(INDEX_NAME, nodeId, KEY, VALUE);
                tx.Success();
            }
            return(nodeId);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAddNodeToExplicitIndex() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAddNodeToExplicitIndex()
        {
            long nodeId;

            using (Transaction tx = beginTransaction())
            {
                nodeId = tx.DataWrite().nodeCreate();
                ExplicitIndexWrite indexWrite = tx.IndexWrite();
                indexWrite.NodeAddToExplicitIndex(INDEX_NAME, nodeId, KEY, VALUE);
                tx.Success();
            }

            // Then
            using (Org.Neo4j.Graphdb.Transaction ctx = graphDb.beginTx())
            {
                IndexHits <Node> hits = graphDb.index().forNodes(INDEX_NAME).get(KEY, VALUE);
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertThat(hits.next().Id, equalTo(nodeId));
                hits.Close();
                ctx.Success();
            }
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void add(org.neo4j.internal.kernel.api.ExplicitIndexWrite operations, String name, long id, String key, Object value) throws org.neo4j.internal.kernel.api.exceptions.explicitindex.ExplicitIndexNotFoundKernelException
            public void add(ExplicitIndexWrite operations, string name, long id, string key, object value)
            {
                operations.NodeAddToExplicitIndex(name, id, key, value);
            }