AI OnAI Off
I also needed category in my search results and this is how i did it.
var searchServiceResults = _searchService.Search(new SearchRequest {Query = query, LanguageId = lang, SortBy = SortOrder.Relevance},false); var model = new List<AutocompleteViewModel>(); foreach (var hit in searchServiceResults.Hits) { var doc = hit.Document as StandardSearchHit; if (doc == null) continue; if (model.Where(x => x.Category == doc.CategoryBreadcrum).ToList().Count >= 3) continue; if(doc.CategoryId != 0) HitWithCategory(query, searchServiceResults, doc, model, hit); } return model;
Hi, is there a way to be able to get the categories in SearchCategories?
When I execute the GetResult() I get an UnifiedSearchHit object that dosent contain the Categories.
Check the x.C where i want to project Categories.
/D