예제 #1
0
        public SearcherContext(Directory dir, Analyzer defaultAnalyzer,
                               TimeSpan targetMinStale, TimeSpan targetMaxStale,
                               TimeSpan commitInterval, TimeSpan optimizeInterval)
        {
            Analyzer = new PerFieldAnalyzerWrapper(defaultAnalyzer);
            _writer  = new IndexWriter(dir, Analyzer, IndexWriter.MaxFieldLength.UNLIMITED);

            Manager    = new NrtManager(_writer);
            _reopener  = new NrtManagerReopener(Manager, targetMaxStale, targetMinStale);
            _committer = new Committer(_writer, commitInterval, optimizeInterval);

            _threads.AddRange(new[] { new Thread(_reopener.Start), new Thread(_committer.Start) });

            foreach (var t in _threads)
            {
                t.Start();
            }
        }
예제 #2
0
        public SearcherContext(Directory dir, Analyzer defaultAnalyzer,
                        TimeSpan targetMinStale, TimeSpan targetMaxStale,
                        TimeSpan commitInterval, TimeSpan optimizeInterval)
        {
            Analyzer = new PerFieldAnalyzerWrapper(defaultAnalyzer);
            _writer = new IndexWriter(dir, Analyzer, IndexWriter.MaxFieldLength.UNLIMITED);

            Manager = new NrtManager(_writer);
            _reopener = new NrtManagerReopener(Manager, targetMaxStale, targetMinStale);
            _committer = new Committer(_writer, commitInterval, optimizeInterval);

            _threads.AddRange(new[] { new Thread(_reopener.Start), new Thread(_committer.Start) });

            foreach (var t in _threads)
            {
                t.Start();
            }
        }