コード例 #1
0
 private Models.SearchParameters CreateSearchParameters(SearchParameters parameters)
 {
     return(new Models.SearchParameters
     {
         Text = parameters.text,
         Facets = CreateFacetParameters(parameters.facets),
         Offset = parameters.offset,
         Limit = parameters.limit,
         OrderBy = parameters.orderby,
         IncludeObjektkatalog = false
     });
 }
コード例 #2
0
        /// <summary>
        /// Register search
        /// </summary>
        public SearchResult Get([System.Web.Http.ModelBinding.ModelBinder(typeof(SM.General.Api.FieldValueModelBinder))] SearchParameters parameters)
        {
            try
            {
                if (parameters == null)
                {
                    parameters = new SearchParameters();
                }

                Models.SearchParameters searchParameters = CreateSearchParameters(parameters);
                searchParameters.AddDefaultFacetsIfMissing();
                Models.SearchResult searchResult = _searchIndexService.Search(searchParameters);


                return(new SearchResult(searchResult));
            }
            catch (Exception ex)
            {
                Log.Error("Error API", ex);
                return(null);
            }
        }