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 ");
                        }
                    }
                }
        }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void applyDocuments(org.apache.lucene.index.IndexWriter writer, IndexType type, org.eclipse.collections.api.map.primitive.LongObjectMap<DocumentContext> documents) throws java.io.IOException
        private void ApplyDocuments(IndexWriter writer, IndexType type, LongObjectMap <DocumentContext> documents)
        {
            foreach (DocumentContext context in documents)
            {
                if (context.Exists)
                {
                    if (LuceneDataSource.DocumentIsEmpty(context.Document))
                    {
                        writer.deleteDocuments(type.IdTerm(context.EntityId));
                    }
                    else
                    {
                        writer.updateDocument(type.IdTerm(context.EntityId), context.Document);
                    }
                }
                else
                {
                    writer.addDocument(context.Document);
                }
            }
        }