Beispiel #1
0
//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));
        }
Beispiel #2
0
//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));
        }
Beispiel #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private SchemaIndex openIndex() throws java.io.IOException
        private SchemaIndex OpenIndex()
        {
            SchemaIndex schemaIndex = NewSchemaIndex();

            schemaIndex.open();
            return(schemaIndex);
        }
Beispiel #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private SchemaIndex createIndex() throws java.io.IOException
        private SchemaIndex CreateIndex()
        {
            SchemaIndex schemaIndex = NewSchemaIndex();

            schemaIndex.create();
            schemaIndex.open();
            return(schemaIndex);
        }
Beispiel #5
0
//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));
        }
Beispiel #6
0
//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();
                }
            }
        }
Beispiel #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void setPartitionSize() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SetPartitionSize()
        {
            System.setProperty("luceneSchemaIndex.maxPartitionSize", _docsPerPartition.ToString());

            Factory <IndexWriterConfig> configFactory = new TestConfigFactory();

            _index = LuceneSchemaIndexBuilder.create(_descriptor, Config.defaults()).withFileSystem(_fileSystem).withIndexRootFolder(new File(_testDir.directory("uniquenessVerification"), "index")).withWriterConfig(configFactory).withDirectoryFactory(DirectoryFactory.PERSISTENT).build();

            _index.create();
            _index.open();
        }
Beispiel #8
0
//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);
            }
        }
Beispiel #9
0
//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.");
            }
        }
Beispiel #10
0
//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);
            }
        }
Beispiel #11
0
//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);
            }
        }
Beispiel #12
0
//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);
            })));
        }
Beispiel #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _index = LuceneSchemaIndexBuilder.create(IndexDescriptorFactory.forSchema(SchemaDescriptorFactory.forLabel(1, 1)), Config.defaults()).withFileSystem(Fs).withIndexRootFolder(Directory.directory()).build();
            _index.create();
            _index.open();
        }