private void Map_EditorialBoardUserAdo_To_SearchResultDocumentDTO(EditorialBoardUserAdo editorialBoardUser, ISearchResultDocumentDTO searchResult) { searchResult.Id = editorialBoardUser.UserId; searchResult.Type = SearchType.EditorialBoard.ToString(); searchResult.Title = editorialBoardUser.FullName; searchResult.Subtitle = GetEditorialBoardUserAffiliation(editorialBoardUser.Affiliations); searchResult.Description = GetRoleAndJournal(editorialBoardUser.Roles); searchResult.Link = GetEditorialBoardUserLink(editorialBoardUser.UserId); }
private ISearchDocumentDTO GetSearchDocumentDTO(ISearchResponse <dynamic> response) { ISearchDocumentDTO searchDocument = new SearchDocumentDTO(); searchDocument.Results = new List <ISearchResultDocumentDTO>(); searchDocument.Count = response.Total; if (response != null && response.Hits != null) { foreach (var hit in response.Hits) { ISearchResultDocumentDTO result = new SearchResultDocumentDTO(); result.Score = hit.Score; switch (hit.Type) { case "article": ArticleAdo article = hit.Source; Map_ArticleAdo_To_SearchResultDocumentDTO(article, result); break; case "research-topic": Journal.Public.DataAccess.ElasticSearch.ADO.ResearchTopic.ResearchTopicAdo researchTopic = hit.Source; Map_ResearchTopicAdo_To_SearchResultDocumentDTO(researchTopic, result); break; case "editorial-board-user": EditorialBoardUserAdo editorialBoard = hit.Source; Map_EditorialBoardUserAdo_To_SearchResultDocumentDTO(editorialBoard, result); break; case "journal": Journal.Public.DataAccess.ElasticSearch.ADO.Journal.JournalAdo journal = hit.Source; Map_JournalAdo_To_SearchResultDocumentDTO(journal, result); break; } searchDocument.Results.Add(result); } } return(searchDocument); }