private JobAdSearchResults GetSearchResults(BrowseResult result, int skip, int take) { // TotalMatches var searchResults = new JobAdSearchResults { TotalMatches = result.getNumHits() }; // JobAdIds var hits = result.getHits(); searchResults.JobAdIds = hits .Skip(skip) .Take(take) .Select(hit => new Guid(_browser.doc(hit.getDocid()).get(SearchFieldName.Id))) .ToArray(); // Facets var facetMap = result.getFacetMap(); if (facetMap != null) { searchResults.IndustryHits = GetFieldHits(facetMap, FieldName.Industries, v => new Guid(v)); searchResults.JobTypeHits = GetFieldHits(facetMap, FieldName.JobTypes, v => JobTypesFieldHandler.Decode(v)); } return(searchResults); }
private ResourceSearchResults GetSearchResults(BrowseResult result, int skip, int take) { // TotalMatches var searchResults = new ResourceSearchResults { TotalMatches = result.getNumHits() }; // ResourceItemIds var hits = result.getHits(); searchResults.ResourceIds = hits .Skip(skip) .Take(take) .Select(hit => new Guid(_browser.doc(hit.getDocid()).get(SearchFieldName.Id))) .ToArray(); // Facets var facetMap = result.getFacetMap(); if (facetMap != null && !facetMap.isEmpty()) { var facets = GetFieldHits(facetMap, FieldName.ItemType, v => v.DecodeToResourceType()); searchResults.ResourceTypeHits = Enum.GetValues(typeof(ResourceType)) .Cast <ResourceType>() .Select(v => new KeyValuePair <ResourceType, int>(v, facets.ContainsKey(v) ? facets[v] : 0)) .ToList(); } return(searchResults); }
private JobAdSearchResults GetSortResults(BrowseResult result, int skip, int take) { // TotalMatches var sortResults = new JobAdSearchResults { TotalMatches = result.getNumHits() }; // JobAdIds var hits = result.getHits(); sortResults.JobAdIds = hits .Skip(skip) .Take(take) .Select(hit => new Guid(_browser.doc(hit.getDocid()).get(SearchFieldName.Id))) .ToArray(); return(sortResults); }