Exemplo n.º 1
0
        public static IndexWriter ConfigureWriter(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit)
        {
            IndexWriterConfig iwc           = CreateWriterConfig(config, runData, mode, commit);
            string            infoStreamVal = config.Get("writer.info.stream", null);

            if (infoStreamVal != null)
            {
                if (infoStreamVal.Equals("SystemOut", StringComparison.Ordinal))
                {
                    iwc.SetInfoStream(Console.Out);
                }
                else if (infoStreamVal.Equals("SystemErr", StringComparison.Ordinal))
                {
                    iwc.SetInfoStream(Console.Error);
                }
                else
                {
                    FileInfo f = new FileInfo(infoStreamVal);
                    iwc.SetInfoStream(new StreamWriter(new FileStream(f.FullName, FileMode.Create, FileAccess.Write), Encoding.GetEncoding(0)));
                }
            }
            IndexWriter writer = new IndexWriter(runData.Directory, iwc);

            return(writer);
        }
Exemplo n.º 2
0
#pragma warning disable IDE0060 // Remove unused parameter
            public NodeState(ShardSearchingTestBase shardSearchingTestBase, Random random, int nodeID, int numNodes)
#pragma warning restore IDE0060 // Remove unused parameter
            {
                this.outerInstance = shardSearchingTestBase;
                MyNodeID           = nodeID;
                Dir = NewFSDirectory(CreateTempDir("ShardSearchingTestBase"));
                // TODO: set warmer
                MockAnalyzer analyzer = new MockAnalyzer(LuceneTestCase.Random);

                analyzer.MaxTokenLength = TestUtil.NextInt32(LuceneTestCase.Random, 1, IndexWriter.MAX_TERM_LENGTH);
                IndexWriterConfig iwc = new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer);

                iwc.SetOpenMode(OpenMode.CREATE);
                if (Verbose)
                {
                    iwc.SetInfoStream(new TextWriterInfoStream(Console.Out));
                }
                Writer    = new IndexWriter(Dir, iwc);
                Mgr       = new SearcherManager(Writer, true, null);
                Searchers = new SearcherLifetimeManager();

                // Init w/ 0s... caller above will do initial
                // "broadcast" by calling initSearcher:
                currentNodeVersions = new long[numNodes];
            }
Exemplo n.º 3
0
            public NodeState(ShardSearchingTestBase outerInstance, Random random, int nodeID, int numNodes)
            {
                this.OuterInstance = outerInstance;
                MyNodeID           = nodeID;
                Dir = NewFSDirectory(CreateTempDir("ShardSearchingTestBase"));
                // TODO: set warmer
                MockAnalyzer analyzer = new MockAnalyzer(Random());

                analyzer.MaxTokenLength = TestUtil.NextInt(Random(), 1, IndexWriter.MAX_TERM_LENGTH);
                IndexWriterConfig iwc = new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer);

                iwc.SetOpenMode(OpenMode.CREATE);
                if (VERBOSE)
                {
                    iwc.SetInfoStream(new PrintStreamInfoStream(Console.Out));
                }
                Writer    = new IndexWriter(Dir, iwc);
                Mgr       = new SearcherManager(Writer, true, null);
                Searchers = new SearcherLifetimeManager();

                // Init w/ 0s... caller above will do initial
                // "broadcast" by calling initSearcher:
                CurrentNodeVersions = new long[numNodes];
            }