public Dictionary <string, List <EHSDoc> > Get(string query) { if (String.IsNullOrEmpty(query)) { query = "*:*"; } var searchService = new EHSSearch(); EhsQuery testQuery = new EhsQuery(); testQuery.QueryText = query; QueryResponse result = searchService.DoSearch(testQuery); List <EHSDoc> EhsDocs = result.Results; Dictionary <string, List <EHSDoc> > GroupedSearchResults = GroupByProducts(EhsDocs); return(GroupedSearchResults); }
public ActionResult Index(SearchVM searchVM) { EhsQuery ehsQuery; usersFirstSearch(); if (searchVM.EhsQuery == null) { ehsQuery = new EhsQuery(); ehsQuery.QueryText = "*:*"; searchVM.EhsQuery = ehsQuery; } else { ehsQuery = searchVM.EhsQuery; } if (searchVM.filters != null) { ehsQuery = CheckForSeaerchFilters(searchVM.filters, ehsQuery); } var searchService = new EHSSearch(); QueryResponse result = searchService.DoSearch(ehsQuery); ModelState.Clear(); searchVM.QueryResponse = result; searchVM.EhsQuery = new EhsQuery(); searchVM.EhsQuery.QueryText = result.QueryText.QueryText; searchVM.filters = BuildFilterCheckBoxes(result, searchVM.filters); return(View(searchVM)); }