//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void propertyAdded(org.neo4j.internal.kernel.api.ExplicitIndexWrite ops, long entityId, int propertyKeyId, org.neo4j.values.storable.Value value) throws org.neo4j.internal.kernel.api.exceptions.explicitindex.AutoIndexingKernelException public override void PropertyAdded(ExplicitIndexWrite ops, long entityId, int propertyKeyId, Value value) { if (_enabled) { try { string name = _propertyKeyLookup.getTokenById(propertyKeyId).name(); if (_propertyKeysToInclude.get().contains(name)) { EnsureIndexExists(ops); _type.add(ops, entityId, name, value.AsObject()); } } catch (KernelException e) { throw new AutoIndexingKernelException(e); } catch (TokenNotFoundException e) { // TODO: TokenNotFoundException was added before there was a kernel. It should be converted to a // KernelException now throw new AutoIndexingKernelException(new PropertyKeyIdNotFoundKernelException(propertyKeyId, e)); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void batchTokenCreateMustIgnoreExistingTokens() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BatchTokenCreateMustIgnoreExistingTokens() { InitialTokensABC(); AtomicInteger nextId = new AtomicInteger(42); MockAssignNewTokenIdsInBatch(nextId); string[] names = new string[] { "b", "X", "a", "Y", "c" }; int[] ids = new int[names.Length]; _holder.getOrCreateIds(names, ids); assertThat(ids.Length, @is(5)); assertThat(ids[0], @is(2)); assertThat(ids[1], isOneOf(42, 43)); assertThat(ids[2], @is(1)); assertThat(ids[3], isOneOf(42, 43)); assertThat(ids[4], @is(3)); assertThat(nextId.get(), @is(44)); // And these should not throw. _holder.getTokenById(42); _holder.getTokenById(43); }
public override long CountIndexedNodes(long nodeId, int[] propertyKeyIds, params Value[] propertyValues) { try { string[] propertyKeys = new string[propertyKeyIds.Length]; for (int i = 0; i < propertyKeyIds.Length; i++) { propertyKeys[i] = _propertyKeyTokenHolder.getTokenById(propertyKeyIds[i]).name(); } Query query = LuceneFulltextDocumentStructure.NewCountNodeEntriesQuery(nodeId, propertyKeys, propertyValues); TotalHitCountCollector collector = new TotalHitCountCollector(); IndexSearcher.search(query, collector); return(collector.TotalHits); } catch (Exception e) { throw new Exception(e); } }