public SearchIndexBuilder(Stream stream, bool ownStream, SearchIndexBuilderConfig config)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            if (config == null)
            {
                config = new SearchIndexBuilderConfig();
            }

            var container    = new SearchIndexContainer(stream, ownStream);
            var writerConfig = new IndexWriterConfig(config.LuceneVersion, config.AnalyzerInternal);
            var writer       = new IndexWriter(container, writerConfig);

            _container = container;
            _writer    = writer;
        }
Exemple #2
0
        private static Stream CreateInMemoryIndex(Action <SearchIndexBuilder> inMemoryIndexBuilder, SearchIndexBuilderConfig config)
        {
            var ms = new MemoryStream();

            using (var index = new SearchIndexBuilder(ms, false, config))
                inMemoryIndexBuilder(index);

            ms.Seek(0, SeekOrigin.Begin);
            return(ms);
        }
 public SearchIndexBuilder(string fileName, SearchIndexBuilderConfig config)
     : this(File.Create(fileName), true, config)
 {
 }