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 WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void ensureWriterInstantiated() throws org.neo4j.internal.kernel.api.exceptions.explicitindex.ExplicitIndexNotFoundKernelException
        internal virtual void EnsureWriterInstantiated()
        {
            if (Searcher == null)
            {
                Searcher = DataSource.getIndexSearcher(Identifier);
                Writer   = Searcher.Writer;
            }
        }
Example #3
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 #4
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);
                }
            }
        }
Example #5
0
 internal WritableIndexReference(IndexIdentifier identifier, IndexSearcher searcher, IndexWriter writer) : base(identifier, searcher)
 {
     this._writer = writer;
 }
Example #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected org.neo4j.graphdb.ResourceIterator<java.io.File> makeSnapshot() throws java.io.IOException
        protected internal override ResourceIterator <File> MakeSnapshot()
        {
            _indexWriter = new IndexWriter(Dir, IndexWriterConfigs.standard());
            return(LuceneIndexSnapshots.ForIndex(IndexDir, _indexWriter));
        }
Example #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public WritableIndexPartition(java.io.File partitionFolder, org.apache.lucene.store.Directory directory, org.apache.lucene.index.IndexWriterConfig writerConfig) throws java.io.IOException
        public WritableIndexPartition(File partitionFolder, Directory directory, IndexWriterConfig writerConfig) : base(partitionFolder, directory)
        {
            this._indexWriter     = new IndexWriter(directory, writerConfig);
            this._searcherManager = new SearcherManager(_indexWriter, new SearcherFactory());
        }