Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void writeSomething(IndexReference indexReference) throws java.io.IOException
        private static void WriteSomething(IndexReference indexReference)
        {
            IndexWriter writer = indexReference.Writer;

            writer.addDocument(new Document());
            writer.commit();
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void createWritablePartition() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void CreateWritablePartition()
        {
            try (AbstractIndexPartition indexPartition = new WritableIndexPartitionFactory(IndexWriterConfigs.standard)
                                                         .createPartition(_testDirectory.directory(), _directory))
                {
                    using (IndexWriter indexWriter = indexPartition.IndexWriter)
                    {
                        indexWriter.addDocument(new Document());
                        indexWriter.commit();
                        indexPartition.maybeRefreshBlocking();
                        using (PartitionSearcher searcher = indexPartition.acquireSearcher())
                        {
                            assertEquals(1, searcher.IndexSearcher.IndexReader.numDocs(), "We should be able to see newly added document ");
                        }
                    }
                }
        }