// // GET: /Web/Product/ /// <summary> /// 搜索结果 /// </summary> /// <returns></returns> public ActionResult SearchResult() { //获取Condition ProductSearchCondition condition = GetSearchCondition(); //获取当前页面Querystring queryStringCollection = Request.QueryString; //获取搜索结果 ProductSearchResult result = ProductSearchFacade.GetProductSearchResultBySolr(condition, queryStringCollection); return(RedirectToAction("SearchResult", "Product")); }
/// <summary> /// 搜索商品 /// </summary> /// <param name="criteria">搜索条件</param> /// <returns></returns> public SearchResultModel Search(SearchCriteriaModel criteria) { var searchCondition = MapSearchCondition(criteria); var searchResult = ProductSearchFacade.GetProductSearchResultBySolr(searchCondition); SearchResultModel model = new SearchResultModel(); model.ProductListItems = TransformResultItemList(searchResult.ProductDataList); model.PageInfo = MapPageInfo(searchResult.ProductDataList); model.PageInfo.PageIndex = criteria.PageIndex; model.Filters = MapSearchFilter(searchResult.Navigation); return(model); }
/// <summary> /// 查询品牌下商品 /// </summary> /// <param name="queryInfo"></param> /// <returns></returns> private static ProductSearchResult GetProductSearchResult(BrandZoneQueryVM queryInfo) { ProductSearchCondition condition = new ProductSearchCondition() { IsGroupQuery = true, KeyWord = queryInfo.Keyword }; //分页 if (queryInfo.PageNumber <= 1) { queryInfo.PageNumber = 1; } condition.PagingInfo = new Utility.DataAccess.SearchEngine.PagingInfo() { PageNumber = queryInfo.PageNumber, PageSize = 15 }; //排序 if (queryInfo.SortMode <= 0) { queryInfo.SortMode = 10; } SortEntity sortEntity = SortKeyValueMappingConfig.SortItemList.Find(f => f.Key == queryInfo.SortMode); if (sortEntity == null) { sortEntity = SortKeyValueMappingConfig.SortItemList[0]; } condition.SortItems = new List <SortItem>() { sortEntity.Item }; condition.NValueList = new List <string>(); condition.Filters = new List <FilterBase>(); if (queryInfo.BrandSysNo > 0) { condition.Filters.Add(new FieldFilter("p_brandid_n", (ConstValue.SINGLE_BRAND_STORE_DMSID_SEED + queryInfo.BrandSysNo).ToString())); } if (!String.IsNullOrWhiteSpace(queryInfo.SubCategoryEnID)) { condition.NValueList.Add(queryInfo.SubCategoryEnID); } var result = ProductSearchFacade.GetProductSearchResultBySolr(condition); return(result); }
internal static ProductSearchResultVM Search(SearchCriteriaModel criteria, NameValueCollection pageQueryString) { var searchCondition = GetSearchCondition(criteria, pageQueryString); var searchResult = ProductSearchFacade.GetProductSearchResultBySolr(searchCondition); ProductSearchResultVM resutlVM = new ProductSearchResultVM(); if (pageQueryString != null) { resutlVM.SortKey = pageQueryString["sort"]; } if (searchResult != null) { resutlVM.ProductList = searchResult.ProductDataList; } return(resutlVM); }
/// <summary> /// 根据类别查询店铺商品 /// </summary> /// <param name="criteria">搜索条件</param> /// <returns></returns> public SearchResultModel GetVendorProductByCategoryCode(int sellerSysNo, int categoryCode) { List <FrontProductCategoryInfo> category = ProductFacade.GetFrontProductCategory(sellerSysNo); int strCurrentCategorySysNo; if (category.Exists(x => x.SysNo == categoryCode)) { strCurrentCategorySysNo = categoryCode; } else { var defaultCate = category.First(p => p.IsLeaf == CommonYesOrNo.Yes); if (defaultCate != null) { strCurrentCategorySysNo = defaultCate.SysNo; } else { strCurrentCategorySysNo = -1; } } ProductSearchCondition condition = new ProductSearchCondition(); condition.NValueList = new List <string>(); //前台分类 condition.NValueList.Add((ConstValue.Product_SINGLE_STORECATE_DMSID_SEED + strCurrentCategorySysNo).ToString()); condition.Filters = new List <FilterBase>(); //商家编号 condition.Filters.Add(new FieldFilter("p_sellersysno", sellerSysNo.ToString())); var searchResult = ProductSearchFacade.GetProductSearchResultBySolr(condition); SearchResultModel model = new SearchResultModel(); model.ProductListItems = TransformResultItemList(searchResult.ProductDataList); model.PageInfo = MapPageInfo(searchResult.ProductDataList); model.Filters = MapSearchFilter(searchResult.Navigation); return(model); }
/// <summary> /// 店铺列表页面信息 /// </summary> /// <param name="sellerSysNo">商铺编号</param> /// <param name="categoryCode">分类系统编号</param> /// <param name="sort">价格升序40、价格降序50,销量降序20</param> /// <param name="keyword">关键字</param> /// <returns></returns> public StoreProductListModel SearchVendorProduct(int sellerSysNo) { #region 旧代码 //List<FrontProductCategoryInfo> category = ProductFacade.GetFrontProductCategoryByVendorSysNo(sellerSysNo); //List<FrontProductCategoryInfo> categoryall = ProductFacade.GetFrontProductCategory(sellerSysNo); //List<string> NValues = new List<string>(); ////前台分类 //if (category.Exists(x => x.SysNo == categoryCode)) //{ // //p1一级分类 // FrontProductCategoryInfo p1 = category.Find(x => x.SysNo == categoryCode); // if (p1.Children.Count > 0) // { // //p2二级分类 // foreach (FrontProductCategoryInfo p2 in p1.Children) // { // if (p2.Children.Count > 0) // { // foreach (FrontProductCategoryInfo p3 in p2.Children) // { // NValues.Add((ConstValue.Product_SINGLE_STORECATE_DMSID_SEED + p3.SysNo).ToString()); // } // } // else // { // NValues.Add((ConstValue.Product_SINGLE_STORECATE_DMSID_SEED + p2.SysNo).ToString()); // } // } // } // else // { // NValues.Add((ConstValue.Product_SINGLE_STORECATE_DMSID_SEED + p1.SysNo).ToString()); // } //} //else //{ // List<FrontProductCategoryInfo> p = categoryall.FindAll(c => c.IsLeaf == CommonYesOrNo.Yes); // foreach (FrontProductCategoryInfo item in p) // { // NValues.Add((ConstValue.Product_SINGLE_STORECATE_DMSID_SEED + item.SysNo).ToString()); // } //} //PagedResult<ProductSearchResultItem> ProductSearch = new PagedResult<ProductSearchResultItem>(); //foreach (var nitem in NValues) //{ // var filter = new SearchFilter(); // filter.SellerSysNo = sellerSysNo; // SolrProductQueryVM vm = new SolrProductQueryVM(); // vm.IsSearchResultPage = 1; // var condition = ProductSearchFacade.GetSearchCondition(vm); // condition.NValueList = new List<string>(); // condition.NFilter = nitem; // condition.NValueList.Add(nitem); // condition.Filters = new List<FilterBase>(); // condition.Filters.Add(new FieldFilter("p_sellersysno", filter.SellerSysNo.ToString())); // var searchresult = ProductSearchFacade.GetProductSearchResultBySolr(condition); // if (searchresult.ProductDataList.Count > 0) // { // foreach (var productitem in searchresult.ProductDataList) // { // ProductSearch.Add(productitem); // } // } //} //var sfilter = new SearchFilter(); //sfilter.SellerSysNo = sellerSysNo; //SolrProductQueryVM qvm = new SolrProductQueryVM(); //qvm.IsSearchResultPage = 1; //var scondition = ProductSearchFacade.GetSearchCondition(qvm); //scondition.NValueList = new List<string>(); //scondition.NFilter = "0"; //scondition.NValueList.Add("0"); //scondition.Filters = new List<FilterBase>(); //scondition.Filters.Add(new FieldFilter("p_sellersysno", sfilter.SellerSysNo.ToString())); //var result = ProductSearchFacade.GetProductSearchResultBySolr(scondition); //result.ProductDataList = ProductSearch; //result.ProductDataList.PageNumber = 1; //result.ProductDataList.PageSize = 24; //result.ProductDataList.TotalRecords = ProductSearch.Count; //StoreProductListModel model = new StoreProductListModel(); //model.ProductListItems = TransformResultItemList(result.ProductDataList); //model.PageInfo = MapPageInfo(result.ProductDataList); //model.Filters = MapSearchFilter(result.Navigation); #endregion var filter = new SearchFilter(); filter.SellerSysNo = sellerSysNo; SolrProductQueryVM vm = new SolrProductQueryVM(); vm.IsSearchResultPage = 1; var condition = ProductSearchFacade.GetSearchCondition(vm); condition.Filters = new List <Nesoft.Utility.DataAccess.SearchEngine.FilterBase>(); condition.Filters.Add(new FieldFilter("p_sellersysno", filter.SellerSysNo.ToString())); var result = ProductSearchFacade.GetProductSearchResultBySolr(condition); result.FilterNavigation.NavigationItems.RemoveAll(p => p.ItemType == NavigationItemType.SubCategory || p.ItemType == NavigationItemType.Category); StoreProductListModel model = new StoreProductListModel(); model.ProductListItems = TransformResultItemList(result.ProductDataList); model.PageInfo = MapPageInfo(result.ProductDataList); model.Filters = MapSearchFilter(result.Navigation); return(model); }