public static SearchHit ToSearchHit(SearchResult hit) { var searchHit = new SearchHit(); // Retrieves fields from Cognitive Search. hit.Document.ToList().ForEach(x => searchHit.PropertyBag.Add(x.Key, x.Value)); //var description = "ππ¨π π§π’ππ’π―π πππ² ππ‘π«ππ¬ππ¬: " + // System.Environment.NewLine + // keyPhrases + // System.Environment.NewLine + // "ππ«π ππ§π’π³πππ’π¨π§π¬ ππππ§ππ’ππ’ππ: " + // System.Environment.NewLine + // organizations + // System.Environment.NewLine // ; return(searchHit); }
public static SearchHit ToSearchHit(SearchResult hit) { // Retrives fields from Cognitive Search. var keyPhrases = string.Join(",", (hit.Document["keyPhrases"] as string[])); if (keyPhrases.Length > 250) { keyPhrases = keyPhrases.Substring(0, 250); } var organizations = string.Join(",", (hit.Document["organizations"] as string[])); if (organizations.Length > 250) { organizations = organizations.Substring(0, 250); } var description = "ππ¨π π§π’ππ’π―π πππ² ππ‘π«ππ¬ππ¬: " + System.Environment.NewLine + keyPhrases + System.Environment.NewLine + "ππ«π ππ§π’π³πππ’π¨π§π¬ ππππ§ππ’ππ’ππ: " + System.Environment.NewLine + organizations + System.Environment.NewLine ; var url = hit.Document["blob_uri"] as string; var searchHit = new SearchHit { documentUrl = url, Description = description }; object Tags; if (hit.Document.TryGetValue("Tags", out Tags)) { searchHit.PropertyBag.Add("Tags", Tags); } return(searchHit); }