Esempio n. 1
0
        private static void Main(string[] args)
        {
            Thread.CurrentThread.Name = "Main";
            var exitEvent = new ManualResetEvent(false);

            Console.CancelKeyPress += (sender, eventArgs) =>
            {
                eventArgs.Cancel = true;
                exitEvent.Set();
            };

            LogProvider.SetCurrentLogProvider(ConsoleLogProvider.Instance);
            using var index = new Index("./lucene-index");
            using var bus   =
                      RabbitHutch.CreateBus(Environment.GetEnvironmentVariable("RABBITMQ_CSTRING") ?? "host=localhost");
            bus.RespondAsync <SearchRequest, SearchResults <Email> >(request =>
                                                                     Task.Factory.StartNew(() => index.Search(request.Text)));
            Console.WriteLine("Running...\nPress Ctrl+C to exit");
            exitEvent.WaitOne();
        }
Esempio n. 2
0
        private async static Task Main(string[] args)
        {
            indexer = new Common.Index(@"./lucene-index");

            await indexer.Build(path, batchSize, new Progress <string>(message => Console.WriteLine(message)));
        }