public override SearchResultItem[] Search(string text) { // make here var items = Global.EngineFactory.GetSearchEngine().Search(text, 0); var list = new List<SearchResultItem>(); foreach (var searchGroup in items) { if (searchGroup.Items.Count == 0) { var item = new SearchResultItem { Name = searchGroup.ProjectTitle, Additional = new Dictionary<string, object> { {"Type", EntityType.Project}, {"imageRef", WebImageSupplier.GetAbsoluteWebPath(GetImage(EntityType.Project), ProductEntryPoint.ID)}, {"Hint", GetHint(EntityType.Project)} }, URL = GetItemPath( EntityType.Project, searchGroup.ProjectID.ToString(), searchGroup.ProjectID), }; list.Add(item); } list.AddRange(searchGroup.Items.Select(searchResultItem => new SearchResultItem { Name = searchResultItem.Title, Description = searchResultItem.Description, Additional = new Dictionary<string, object> { {"ProjectName", searchGroup.ProjectTitle}, {"Type", searchResultItem.EntityType}, {"imageRef", WebImageSupplier.GetAbsoluteWebPath(GetImage(searchResultItem.EntityType), ProductEntryPoint.ID)}, {"Hint", GetHint(searchResultItem.EntityType)} }, URL = GetItemPath(searchResultItem.EntityType, searchResultItem.ID, searchGroup.ProjectID), Date = searchResultItem.CreateOn })); } return list.ToArray(); }
public override SearchResultItem[] Search(string text) { var users = new List<UserInfo>(); var result = new List<SearchResultItem>(); users.AddRange(CoreContext.UserManager.Search(text, EmployeeStatus.Active)); foreach (var user in users) { var sri = new SearchResultItem { Name = user.DisplayUserName(false), Description = string.Format("{2}{1} {0}", user.Department, !String.IsNullOrEmpty(user.Department) ? "," : String.Empty, user.Title), //Description = //string.Format("{0}: {1}, {2}: {3}",CustomNamingPeople.Substitute<Resources.Resource>("Department"),user.Department,CustomNamingPeople.Substitute<Resources.Resource>("UserPost"),user.Title), URL = GetEmployeeUrl(user), Date = user.WorkFromDate, Additional = new Dictionary<string, object> {{"imageRef", user.GetSmallPhotoURL()}} }; result.Add(sri); } return result.ToArray(); }
public SearchResultItem GetSearchResultItem(SearchGroup searchGroup, SearchItem searchResultItem) { var result = new SearchResultItem { Name = searchResultItem.Title, Additional = new Dictionary<string, object> { { "Type", searchResultItem.EntityType }, { "imageRef", WebImageSupplier.GetAbsoluteWebPath(GetImage(searchResultItem.EntityType), ProductEntryPoint.ID) }, { "Hint", GetHint(searchResultItem.EntityType) } }, URL = GetItemPath(searchResultItem.EntityType, searchResultItem.ID, searchGroup.ProjectID) }; if (searchResultItem.EntityType != EntityType.Project) { result.Additional.Add("ProjectName", searchGroup.ProjectTitle); result.Date = searchResultItem.CreateOn; result.Description = searchResultItem.Description; } return result; }