public void ReindexAllTest()
        {
            var config = new ConfigManager();
            using (var currentDB = new NAppProfiler.Server.Essent.Database(config))
            {
                currentDB.InitializeDatabase();
                using (var idxUpdate = new NAppIndexUpdater(config, currentDB))
                {
                    idxUpdate.Initialize();
                    DateTime start;
                    DateTime stop;
                    TimeSpan ts;
                    start = DateTime.UtcNow;
                    var count = idxUpdate.RebuildIndex();

                    //var totalCount = 0L;
                    //var curCount = 1L;
                    //while (curCount > 0)
                    //{
                    //    curCount = idxUpdate.UpdateIndex();
                    //    totalCount += curCount;
                    //}

                    stop = DateTime.UtcNow;
                    ts = stop - start;
                    Console.WriteLine("Index Rebuild " + count.ToString("#,##0") + " in " + ts.TotalMilliseconds.ToString("#,##0") + " ms");
                }
            }
        }
예제 #2
0
        public Job(ConfigManager config, JobQueueManager manager, bool IsDatabaseTask, bool traceEnabled)
        {
            this.config = config;
            this.manager = manager;
            if (IsDatabaseTask)
            {
                currentDb = new Database(config);
                currentDb.InitializeDatabase();
                indexUpdater = new NAppIndexUpdater(config, currentDb);
                indexUpdater.Initialize();
            }
            indexReader = new NAppIndexReader(config);

            this.traceEnabled = traceEnabled;
        }