コード例 #1
0
        public ActionResult RebuildIndex(string indexName = null)
        {
            if (!ExamineManager.Instance.TryGetIndex(indexName ?? "Simple2Indexer", out var index))
            {
                return(HttpNotFound());
            }

            var elapsed = Execute(index, i =>
            {
                try
                {
                    var timer = new Stopwatch();
                    timer.Start();
                    index.CreateIndex();
                    var dataService = new TableDirectReaderDataService();
                    //NOTE: Max 10k for now since that is the azure search limit for testing.
                    index.IndexItems(dataService.GetAllData().Take(10000));
                    timer.Stop();

                    return(timer.Elapsed.TotalSeconds);
                }
                catch (Exception ex)
                {
                    throw;
                }
            });

            return(View(elapsed));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: randyammar/Examine
        private ActionResult RebuildImpl(IIndex index)
        {
            try
            {
                var timer = new Stopwatch();
                timer.Start();
                index.CreateIndex();
                var dataService = new TableDirectReaderDataService();
                index.IndexItems(dataService.GetAllData());
                timer.Stop();

                return(View(timer.Elapsed.TotalSeconds));
            }
            catch (Exception ex)
            {
                this.ModelState.AddModelError("DataError", ex.Message);
                return(View(0.0));
            }
        }
コード例 #3
0
        public ActionResult ReIndexEachItemIndividually()
        {
            try
            {
                var timer = new Stopwatch();
                timer.Start();
                var ds = new TableDirectReaderDataService();
                foreach (var i in ds.GetAllData("TestType"))
                {
                    ExamineManager.Instance.IndexProviderCollection["Simple2Indexer"]
                    .ReIndexNode(i.RowData.ToExamineXml(i.NodeDefinition.NodeId, i.NodeDefinition.Type), "TestType");
                }
                timer.Stop();

                return(View(timer.Elapsed.TotalSeconds));
            }
            catch (Exception ex)
            {
                this.ModelState.AddModelError("DataError", ex.Message);
                return(View(0));
            }
        }
コード例 #4
0
ファイル: HomeController.cs プロジェクト: Xamarui/Examine
        public ActionResult ReIndexEachItemIndividually()
        {
            try
            {
                var timer = new Stopwatch();
                timer.Start();
                var ds = new TableDirectReaderDataService();
                foreach (var i in ds.GetAllData("TestType"))
                {                    
                    ExamineManager.Instance.IndexProviderCollection["Simple2Indexer"]
                        .ReIndexNode(i.RowData.ToExamineXml(i.NodeDefinition.NodeId, i.NodeDefinition.Type), "TestType");  
                }                
                timer.Stop();

                return View(timer.Elapsed.TotalSeconds);
            }
            catch (Exception ex)
            {
                this.ModelState.AddModelError("DataError", ex.Message);
                return View(0);
            }
        }