示例#1
0
        public ActionResult Index(SearchAdminViewModel svm)
        {
            var messages = new List<MsgViewModel>();

            if (svm.Action == "Requests")
            {
                using (var searchIndex = new SearchIndex<Request, RequestIndexDefinition>())
                {
                    searchIndex.ClearLuceneIndex();
                    searchIndex.AddOrUpdateAll(GetAllRequests());
                    messages.Add(MsgViewModel.SuccessMsg("Index has been rebuilt."));
                }
            }
            /* else if (svm.Action == "Autocomplete")
            {
                using (FSDirectory d = FSDirectory.Open(new DirectoryInfo(SearchIndex<Request, RequestIndexDefinition>.DirPath)))
                {
                    SearchAutoComplete sac = new SearchAutoComplete(AppDomain.CurrentDomain.BaseDirectory + "/App_Data/SearchAutocompleteIndex");
                    sac.BuildAutoCompleteIndex(d, "Keywords");
                }
                messages.Add(MsgViewModel.SuccessMsg("Rebuilt autocomplete index."));
            } */

            ViewBag.Alerts = messages;

            ViewBag.SearchAdminActive = true;
            return View(svm);
        }
示例#2
0
 public ActionResult Index()
 {
     SearchAdminViewModel svm = new SearchAdminViewModel();
     ViewBag.SearchAdminActive = true;
     return View(svm);
 }