Example #1
0
        /// <summary>
        /// Build lucene schema index with specified configuration
        /// </summary>
        /// <returns> lucene schema index </returns>
        public virtual DatabaseFulltextIndex Build()
        {
            if (ReadOnly)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.api.impl.index.partition.ReadOnlyIndexPartitionFactory partitionFactory = new org.neo4j.kernel.api.impl.index.partition.ReadOnlyIndexPartitionFactory();
                ReadOnlyIndexPartitionFactory partitionFactory = new ReadOnlyIndexPartitionFactory();
                LuceneFulltextIndex           fulltextIndex    = new LuceneFulltextIndex(StorageBuilder.build(), partitionFactory, _descriptor, _propertyKeyTokenHolder);
                return(new ReadOnlyFulltextIndex(fulltextIndex));
            }
            else
            {
                Factory <IndexWriterConfig> writerConfigFactory;
                if (_populating)
                {
                    writerConfigFactory = () => IndexWriterConfigs.population(_descriptor.analyzer());
                }
                else
                {
                    writerConfigFactory = () => IndexWriterConfigs.standard(_descriptor.analyzer());
                }
                WritableIndexPartitionFactory partitionFactory = new WritableIndexPartitionFactory(writerConfigFactory);
                LuceneFulltextIndex           fulltextIndex    = new LuceneFulltextIndex(StorageBuilder.build(), partitionFactory, _descriptor, _propertyKeyTokenHolder);
                return(new WritableFulltextIndex(_indexUpdateSink, fulltextIndex));
            }
        }