public ActionResult Index(InspectViewModel model)
        {
            model.Languages        = _languageBranchRepository.ListEnabled();
            model.SelectedLanguage = model.SelectedLanguage ?? model.Languages.First().LanguageID;
            model.Indices          = _elasticSearchSettings.Indices.ToList();
            model.SelectedIndex    = model.SelectedIndex ?? _elasticSearchSettings.Index;
            model.NumberOfItems    = new List <int> {
                10, 20, 50, 100, 1000, 10000
            };
            model.SelectedNumberOfItems = model.SelectedNumberOfItems > 0 ? model.SelectedNumberOfItems : model.NumberOfItems.First();

            model.SearchHits = _inspectorRepository.Search(model.SelectedLanguage, model.SearchText, model.SelectedNumberOfItems, model.SelectedType, model.SelectedIndex);
            model.TypeCounts = _inspectorRepository.GetTypes(model.SelectedLanguage, model.SearchText, model.SelectedIndex);

            return(View("~/Views/ElasticSearchAdmin/IndexInspector/Index.cshtml", model));
        }
Esempio n. 2
0
        private InspectViewModel GetModel(InspectViewModel model)
        {
            foreach (var language in Languages)
            {
                var id   = language.Key;
                var name = language.Value;
                name = String.Concat(name.Substring(0, 1).ToUpper(), name.Substring(1));

                model.AddLanguage(
                    name,
                    id,
                    UniqueIndices);
            }

            model.NumberOfItems = new List <int> {
                10, 20, 50, 100, 1000, 10000
            };
            model.SelectedNumberOfItems = model.SelectedNumberOfItems > 0 ? model.SelectedNumberOfItems : model.NumberOfItems.First();
            model.SearchHits            = _inspectorRepository.Search(model.SearchText, model.Analyzed, CurrentLanguage, CurrentIndex, model.SelectedNumberOfItems, model.SelectedType, CurrentIndex);
            model.TypeCounts            = _inspectorRepository.GetTypes(model.SearchText, CurrentIndex);

            return(model);
        }