/// <summary> /// Main search page. Contains all datasets /// </summary> /// <param name="parameters">Facets</param> /// <returns>/search</returns> public ActionResult Index(SearchParameters parameters) { parameters.AddComplexFacetsIfMissing(); var searchResult = _searchService.Search(parameters); Kartverket.Metadatakatalog.Models.Article.SearchParameters articleParameters = new Models.Article.SearchParameters(); articleParameters.Text = parameters.Text; articleParameters.Limit = 200; if (string.IsNullOrEmpty(parameters.Text)) { articleParameters.orderby = "StartPublish"; } var articleResult = _articleService.Search(articleParameters); var model = new SearchViewModel(parameters, searchResult, articleResult); return(View(model)); }
/// <summary> /// Catalogue search /// </summary> public SearchResult Get([System.Web.Http.ModelBinding.ModelBinder(typeof(SearchParameterModelBuilder))] SearchParameters parameters) { try { if (parameters == null) { parameters = new SearchParameters(); } Models.SearchParameters searchParameters = CreateSearchParameters(parameters); searchParameters.AddDefaultFacetsIfMissing(); Models.SearchResult searchResult = _searchServiceAll.Search(searchParameters); var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext); return(new SearchResult(searchResult, urlHelper)); } catch (Exception ex) { Log.Error("Error API", ex); return(null); } }