//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void readOnlyIndexCreation() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ReadOnlyIndexCreation() { using (SchemaIndex schemaIndex = LuceneSchemaIndexBuilder.Create(_descriptor, ReadOnlyConfig).withFileSystem(_fileSystemRule).withOperationalMode(OperationalMode.single).withIndexRootFolder(_testDir.directory("a")).build()) { assertTrue(schemaIndex.ReadOnly, "Builder should construct read only index."); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void writableIndexCreation() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void WritableIndexCreation() { using (SchemaIndex schemaIndex = LuceneSchemaIndexBuilder.Create(_descriptor, DefaultConfig).withFileSystem(_fileSystemRule).withOperationalMode(OperationalMode.single).withIndexRootFolder(_testDir.directory("b")).build()) { assertFalse(schemaIndex.ReadOnly, "Builder should construct writable index."); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private LuceneIndexAccessor createAccessor(org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage indexStorage) throws java.io.IOException private LuceneIndexAccessor CreateAccessor(PartitionedIndexStorage indexStorage) { SchemaIndex luceneIndex = LuceneSchemaIndexBuilder.Create(_index, Config.defaults()).withIndexStorage(indexStorage).build(); luceneIndex.open(); return(new LuceneIndexAccessor(luceneIndex, _index)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.kernel.api.index.IndexAccessor getOnlineAccessor(org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor, org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig samplingConfig) throws java.io.IOException public override IndexAccessor GetOnlineAccessor(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig) { SchemaIndex luceneIndex = LuceneSchemaIndexBuilder.Create(descriptor, _config).withOperationalMode(_operationalMode).withSamplingConfig(samplingConfig).withIndexStorage(GetIndexStorage(descriptor.Id)).build(); luceneIndex.open(); return(new LuceneIndexAccessor(luceneIndex, descriptor)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private LuceneIndexAccessor createDefaultIndexAccessor() throws java.io.IOException private LuceneIndexAccessor CreateDefaultIndexAccessor() { SchemaIndex index = LuceneSchemaIndexBuilder.Create(_descriptor, _config).withFileSystem(_fileSystem).withIndexRootFolder(_testDir.directory("testIndex")).build(); index.create(); index.open(); return(new LuceneIndexAccessor(index, _descriptor)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private boolean indexIsOnline(org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage indexStorage, org.neo4j.storageengine.api.schema.IndexDescriptor descriptor) throws java.io.IOException private bool IndexIsOnline(PartitionedIndexStorage indexStorage, IndexDescriptor descriptor) { using (SchemaIndex index = LuceneSchemaIndexBuilder.Create(descriptor, _config).withIndexStorage(indexStorage).build()) { if (index.exists()) { index.open(); return(index.Online); } return(false); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void updateMultiplePartitionedIndex() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void UpdateMultiplePartitionedIndex() { using (SchemaIndex index = LuceneSchemaIndexBuilder.Create(_descriptor, _config).withFileSystem(_fileSystem).withIndexRootFolder(_testDir.directory("partitionedIndexForUpdates")).build()) { index.create(); index.open(); AddDocumentToIndex(index, 45); index.IndexWriter.updateDocument(LuceneDocumentStructure.NewTermForChangeOrRemove(100), LuceneDocumentStructure.DocumentRepresentingProperties(( long )100, Values.intValue(100))); index.maybeRefreshBlocking(); long documentsInIndex = Iterators.count(index.allDocumentsReader().GetEnumerator()); assertEquals(46, documentsInIndex, "Index should contain 45 added and 1 updated document."); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void createFailPartitionedIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void CreateFailPartitionedIndex() { using (SchemaIndex failedIndex = LuceneSchemaIndexBuilder.Create(_descriptor, _config).withFileSystem(_fileSystem).withIndexRootFolder(new File(_testDir.directory("failedIndexFolder"), "failedIndex")).build()) { failedIndex.open(); AddDocumentToIndex(failedIndex, 35); assertEquals(4, failedIndex.Partitions.size()); failedIndex.markAsFailed("Some failure"); failedIndex.flush(); assertTrue(failedIndex.Open); assertFalse(failedIndex.Online); } }
public override IndexPopulator GetPopulator(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig, ByteBufferFactory bufferFactory) { SchemaIndex luceneIndex = LuceneSchemaIndexBuilder.Create(descriptor, _config).withFileSystem(_fileSystem).withOperationalMode(_operationalMode).withSamplingConfig(samplingConfig).withIndexStorage(GetIndexStorage(descriptor.Id)).withWriterConfig(IndexWriterConfigs.population).build(); if (luceneIndex.ReadOnly) { throw new System.NotSupportedException("Can't create populator for read only index"); } if (descriptor.Type() == UNIQUE) { return(new UniqueLuceneIndexPopulator(luceneIndex, descriptor)); } else { return(new NonUniqueLuceneIndexPopulator(luceneIndex, samplingConfig)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void openClosePartitionedIndex() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void OpenClosePartitionedIndex() { SchemaIndex reopenIndex = null; try { reopenIndex = LuceneSchemaIndexBuilder.Create(_descriptor, _config).withFileSystem(_fileSystem).withIndexRootFolder(new File(_testDir.directory("reopenIndexFolder"), "reopenIndex")).build(); reopenIndex.open(); AddDocumentToIndex(reopenIndex, 1); reopenIndex.close(); assertFalse(reopenIndex.Open); reopenIndex.open(); assertTrue(reopenIndex.Open); AddDocumentToIndex(reopenIndex, 10); reopenIndex.close(); assertFalse(reopenIndex.Open); reopenIndex.open(); assertTrue(reopenIndex.Open); reopenIndex.close(); reopenIndex.open(); AddDocumentToIndex(reopenIndex, 100); reopenIndex.maybeRefreshBlocking(); using (LuceneAllDocumentsReader allDocumentsReader = reopenIndex.allDocumentsReader()) { assertEquals(111, allDocumentsReader.MaxCount(), "All documents should be visible"); } } finally { if (reopenIndex != null) { reopenIndex.close(); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void createPopulateDropIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void CreatePopulateDropIndex() { File crudOperation = _testDir.directory("indexCRUDOperation"); using (SchemaIndex crudIndex = LuceneSchemaIndexBuilder.Create(_descriptor, _config).withFileSystem(_fileSystem).withIndexRootFolder(new File(crudOperation, "crudIndex")).build()) { crudIndex.open(); AddDocumentToIndex(crudIndex, 1); assertEquals(1, crudIndex.Partitions.size()); AddDocumentToIndex(crudIndex, 21); assertEquals(3, crudIndex.Partitions.size()); crudIndex.drop(); assertFalse(crudIndex.Open); assertEquals(0, crudOperation.list().length); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Parameterized.Parameters(name = "{0}") public static java.util.Collection<Object[]> implementations() public static ICollection <object[]> Implementations() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.io.File dir = new java.io.File("dir"); File dir = new File("dir"); return(Arrays.asList(Arg(_generalIndex, dirFactory1 => { SchemaIndex index = LuceneSchemaIndexBuilder.Create(_generalIndex, _config).withFileSystem(FileSystemRule.get()).withDirectoryFactory(dirFactory1).withIndexRootFolder(new File(dir, "1")).build(); index.create(); index.open(); return new LuceneIndexAccessor(index, _generalIndex); }), Arg(_uniqueIndex, dirFactory1 => { SchemaIndex index = LuceneSchemaIndexBuilder.Create(_uniqueIndex, _config).withFileSystem(FileSystemRule.get()).withDirectoryFactory(dirFactory1).withIndexRootFolder(new File(dir, "testIndex")).build(); index.create(); index.open(); return new LuceneIndexAccessor(index, _uniqueIndex); }))); }
private SchemaIndex NewSchemaIndex() { LuceneSchemaIndexBuilder builder = LuceneSchemaIndexBuilder.Create(_descriptor, Config.defaults()); return(builder.WithIndexRootFolder(new File(_testDir.directory("index"), "testIndex")).withDirectoryFactory(_dirFactory).withFileSystem(_fs).build()); }