/// <summary> /// Advanced Search /// </summary> /// <param name="advancedSearch"> Object advandced search</param> /// <returns></returns> public List<SearchDocumentResult> AdvancedSearch(AdvancedSearchDto advancedSearch, SortBy sortBy) { var result = new List<SearchDocumentResult>(); if (advancedSearch != null) { try { string strResponse = string.Empty; // String search query string strQuery = BuildSearchQuery(advancedSearch); // String search option string strOption = BuildSearchOption(SearchOptionConst.And, false); // Call Amazon Cloud Search API Service AmazonCloudSearcher ObjCloudSearch = new AmazonCloudSearcher(); strResponse = ObjCloudSearch.SearchRequest(ApiEndpoint, ApiVersion, strQuery, strOption, "_all_fields,_score", SearchOptionConst.SortByScoreDesc, DataFormat.Json); result = GetSearchDocumentList(strResponse); return result; } catch (Exception e) { Log.Error("Advanced search error. Message: " + e.Message + " Stack trace: " + e.StackTrace); } } return null; }
/// <summary> /// Standard search /// </summary> /// <param name="keySearch">String search</param> /// <returns></returns> public List<SearchDocumentResult> StandardSearch(string keySearch, SortBy sortBy) { var result = new List<SearchDocumentResult>(); string strResponse = string.Empty; // String search query string strQuery = BuildSearchQuery(keySearch); // String search option string strOption = BuildSearchOption(SearchOptionConst.Or, true); // Call Amazon Cloud Search API Service AmazonCloudSearcher ObjCloudSearch = new AmazonCloudSearcher(); strResponse = ObjCloudSearch.SearchRequest(ApiEndpoint, ApiVersion, strQuery, strOption, "_all_fields,_score", SearchOptionConst.SortByScoreDesc, DataFormat.Json); result = GetSearchDocumentList(strResponse); return result; }