public ActionResult Knowledeg(string kw = "", string order = "CreateTime", int pageIndex = 1, int pageSize = 20, int suffix = 0) { FullSearchService.KeyWordManager.AddWord(kw, CurrentUser.TenantId); var must = new Dictionary <string, object>() { { "status", 1 }, { "isDeleted", 0 } }; if (suffix != 0) { if (_fileExtendIndexs.ContainsKey(suffix)) { var exName = _fileExtendIndexs[suffix]; must.Add("extendGeneralName", exName); } } long total; var models = FullTextSearchProvider.Search <KL_Resource>( out total, "KL_Resource", new[] { "resourceName", "memo", "tags", "fileContent" }, kw, (pageIndex - 1) * pageSize, pageSize, "<em>", "</em>", must); return (View(new RetechWing.MvcPager.PagedList <SearchResult <KL_Resource> >( models, pageIndex, pageSize, (int)total))); }
public ActionResult SearchResource(string kw = "", string orderF = "CreateTime", int dir = 1, int pageIndex = 1, int pageSize = 20, string ext = "") { var must = new Dictionary <string, object>() { { "tenantId", CurrentTenant.TenantId }, { "status", 1 }, { "isDeleted", 0 } }; if (ext.Length != 0) { must["extendNameType"] = ext; } long total; var models = FullTextSearchProvider.Search <KL_Resource>( out total, "knowledge", new[] { "resourceName", "fileContent", "memo", "tags", "levelPath", "createrName" }, kw, (pageIndex - 1) * pageSize, pageSize, "<b>", "</b>", must); return (View(new RetechWing.MvcPager.PagedList <SearchResult <KL_Resource> >( models, pageIndex, pageSize, (int)total))); }
// // GET: /Search/ public ActionResult Course(string kw = "", string order = "courseName", int pageIndex = 1, int pageSize = 20, int dir = 0) { //记录关键字 FullSearchService.KeyWordManager.AddWord(kw, CurrentUser.TenantId); var otherConditions = new Dictionary <string, object>(); long recordCount; var searchResult = FullTextSearchProvider.Search <FullTextSearchCourse>(out recordCount , "course", new[] { "courseName", "outline", "resourceNames", "categoryName" } , kw, (pageIndex - 1) * pageSize , pageSize , "<em>" , "</em>" , otherConditions , dir , order); var list = new PagedList <SearchResult <FullTextSearchCourse> >(searchResult, pageIndex, pageSize, (int)recordCount); return(View(list)); }
public ActionResult Train(string kw = "", string order = "trainName", int pageIndex = 1, int pageSize = 20, int dir = 0) { //记录关键字 FullSearchService.KeyWordManager.AddWord(kw, CurrentUser.TenantId); var otherConditions = new Dictionary <string, object>(); long recordCount; var searchResult = FullTextSearchProvider.Search <Models.TrainSearchModel>(out recordCount , "traininfo", new[] { "trainName", "trainDescription", "details", "crowd" } , kw, (pageIndex - 1) * pageSize , pageSize , "<em>" , "</em>" , otherConditions , dir , order); var list = new PagedList <SearchResult <TrainSearchModel> >(searchResult, pageIndex, pageSize, (int)recordCount); //int total = 0; //var list = _fullSearchManager.SearchTrain(out total//总记录数 // , CurrentTenant.TenantId//租户Id // , kw//关键字 // , (pageIndex - 1) * pageSize//跳过记录数 // , pageSize//保留记录数 // , order//排序字段 // , FullSearch_Train.OrderFields[order]//排序字段类型 // , true//是否倒序排列 // ); //var analysisWords = _fullSearchManager.AnalysisWord(kw); //foreach (var result in list) //{ // var course = (TrTrainingInfo)result.DbEntity; // foreach (var word in analysisWords) // { // course.TrainName = course.TrainName.Replace(word.Key, "<em>" + word.Key + "</em>"); // } //} return(View(list)); }