//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void verifyRelationshipData(FulltextIndexProvider provider, long secondRelId) throws Exception private void VerifyRelationshipData(FulltextIndexProvider provider, long secondRelId) { using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = LuceneFulltextTestSupport.KernelTransaction(tx); ScoreEntityIterator result = provider.Query(ktx, "fulltext", "valuuu"); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(result.HasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(0L, result.Next().entityId()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(result.HasNext()); result = provider.Query(ktx, "fulltext", "villa"); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(result.HasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(secondRelId, result.Next().entityId()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(result.HasNext()); result = provider.Query(ktx, "fulltext", "value3"); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(result.HasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(0L, result.Next().entityId()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(result.HasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(secondRelId, result.Next().entityId()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(result.HasNext()); tx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void createAndQueryFulltextRelationshipIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CreateAndQueryFulltextRelationshipIndex() { FulltextIndexProvider provider = ( FulltextIndexProvider )Db.resolveDependency(typeof(IndexProviderMap)).lookup(DESCRIPTOR); IndexReference indexReference; using (KernelTransactionImplementation transaction = KernelTransaction) { MultiTokenSchemaDescriptor multiTokenSchemaDescriptor = multiToken(new int[] { 0, 1, 2 }, EntityType.RELATIONSHIP, 0, 1, 2, 3); FulltextSchemaDescriptor schema = new FulltextSchemaDescriptor(multiTokenSchemaDescriptor, new Properties()); indexReference = transaction.SchemaWrite().indexCreate(schema, DESCRIPTOR.name(), "fulltext"); transaction.Success(); } Await(indexReference); long secondRelId; using (Transaction transaction = Db.beginTx()) { Relationship ho = _node1.createRelationshipTo(_node2, RelationshipType.withName("ho")); secondRelId = ho.Id; ho.SetProperty("hej", "villa"); ho.SetProperty("ho", "value3"); transaction.Success(); } VerifyRelationshipData(provider, secondRelId); Db.restartDatabase(DatabaseRule.RestartAction_Fields.EMPTY); provider = ( FulltextIndexProvider )Db.resolveDependency(typeof(IndexProviderMap)).lookup(DESCRIPTOR); VerifyRelationshipData(provider, secondRelId); }
public override Lifecycle NewInstance(KernelContext context, Dependencies dependencies) { Config config = dependencies.Config; bool ephemeral = config.Get(GraphDatabaseSettings.ephemeral); FileSystemAbstraction fileSystemAbstraction = dependencies.FileSystem(); DirectoryFactory directoryFactory = directoryFactory(ephemeral); OperationalMode operationalMode = context.DatabaseInfo().OperationalMode; JobScheduler scheduler = dependencies.Scheduler(); IndexDirectoryStructure.Factory directoryStructureFactory = SubProviderDirectoryStructure(context.Directory()); TokenHolders tokenHolders = dependencies.TokenHolders(); Log log = dependencies.LogService.getInternalLog(typeof(FulltextIndexProvider)); AuxiliaryTransactionStateManager auxiliaryTransactionStateManager; try { auxiliaryTransactionStateManager = dependencies.AuxiliaryTransactionStateManager(); } catch (UnsatisfiedDependencyException e) { string message = "Fulltext indexes failed to register as transaction state providers. This means that, if queried, they will not be able to " + "uncommitted transactional changes into account. This is fine if the indexes are opened for non-transactional work, such as for " + "consistency checking. The reason given is: " + e.Message; LogDependencyException(context, log.ErrorLogger(), message); auxiliaryTransactionStateManager = new NullAuxiliaryTransactionStateManager(); } FulltextIndexProvider provider = new FulltextIndexProvider(Descriptor, directoryStructureFactory, fileSystemAbstraction, config, tokenHolders, directoryFactory, operationalMode, scheduler, auxiliaryTransactionStateManager, log); string procedureRegistrationFailureMessage = "Failed to register the fulltext index procedures. The fulltext index provider will be loaded and " + "updated like normal, but it might not be possible to query any fulltext indexes. The reason given is: "; try { dependencies.Procedures().registerComponent(typeof(FulltextAdapter), procContext => provider, true); dependencies.Procedures().registerProcedure(typeof(FulltextProcedures)); } catch (KernelException e) { string message = procedureRegistrationFailureMessage + e.getUserMessage(new NonTransactionalTokenNameLookup(tokenHolders)); // We use the 'warn' logger in this case, because it can occur due to multi-database shenanigans, or due to internal restarts in HA. // These scenarios are less serious, and will _probably_ not prevent FTS from working. Hence we only warn about this. LogDependencyException(context, log.WarnLogger(), message); } catch (UnsatisfiedDependencyException e) { string message = procedureRegistrationFailureMessage + e.Message; LogDependencyException(context, log.ErrorLogger(), message); } return(provider); }
internal FulltextIndexTransactionState(FulltextIndexProvider provider, Log log, IndexReference indexReference) { FulltextIndexAccessor accessor = provider.GetOpenOnlineAccessor(( StoreIndexDescriptor )indexReference); log.Debug("Acquired online fulltext schema index accessor, as base accessor for transaction state: %s", accessor); _descriptor = accessor.Descriptor; SchemaDescriptor schema = _descriptor.schema(); _toCloseLater = new List <AutoCloseable>(); _writer = accessor.TransactionStateIndexWriter; _modifiedEntityIdsInThisTransaction = new LongHashSet(); _visitingNodes = Schema.entityType() == EntityType.NODE; _txStateVisitor = new FulltextIndexTransactionStateVisitor(_descriptor, _modifiedEntityIdsInThisTransaction, _writer); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void createAndQueryFulltextIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CreateAndQueryFulltextIndex() { IndexReference indexReference; FulltextIndexProvider provider = ( FulltextIndexProvider )Db.resolveDependency(typeof(IndexProviderMap)).lookup(DESCRIPTOR); indexReference = CreateIndex(new int[] { 0, 1, 2 }, new int[] { 0, 1, 2, 3 }); Await(indexReference); long thirdNodeid; thirdNodeid = CreateTheThirdNode(); VerifyNodeData(provider, thirdNodeid); Db.restartDatabase(DatabaseRule.RestartAction_Fields.EMPTY); provider = ( FulltextIndexProvider )Db.resolveDependency(typeof(IndexProviderMap)).lookup(DESCRIPTOR); VerifyNodeData(provider, thirdNodeid); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void verifyNodeData(FulltextIndexProvider provider, long thirdNodeid) throws Exception private void VerifyNodeData(FulltextIndexProvider provider, long thirdNodeid) { using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = LuceneFulltextTestSupport.KernelTransaction(tx); ScoreEntityIterator result = provider.Query(ktx, "fulltext", "value"); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(result.HasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(0L, result.Next().entityId()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(result.HasNext()); result = provider.Query(ktx, "fulltext", "villa"); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(result.HasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(thirdNodeid, result.Next().entityId()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(result.HasNext()); result = provider.Query(ktx, "fulltext", "value3"); PrimitiveLongSet ids = Primitive.longSet(); ids.Add(0L); ids.Add(thirdNodeid); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(result.HasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(ids.Remove(result.Next().entityId())); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(result.HasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(ids.Remove(result.Next().entityId())); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(result.HasNext()); tx.Success(); } }
internal FulltextAuxiliaryTransactionState(FulltextIndexProvider provider, Log log) { this._provider = provider; this._log = log; _indexStates = new Dictionary <IndexReference, FulltextIndexTransactionState>(); }