private ApiSearchRequest BuildRequest(Period period, string[] users) { var issuesRequestBuilder = new SearchRequestBuilder() .WorklogStartAt(period.StartDate) .WorklogEndAt(period.EndDate) .IncludeFields("summary", "worklog", "assignee", "status", "key"); foreach (var user in users) { issuesRequestBuilder.WorklogAuthor(user); } return(issuesRequestBuilder.Build()); }
public virtual async Task <LoadProductResponse> Handle(LoadProductRequest request, CancellationToken cancellationToken) { var result = new LoadProductResponse(); var searchRequest = new SearchRequestBuilder() .WithPaging(0, request.Ids.Count()) .WithIncludeFields(request.IncludeFields.Concat(new[] { "id" }).Select(x => "__object." + x).ToArray()) .WithIncludeFields(request.IncludeFields.Where(x => x.StartsWith("prices.")).Concat(new[] { "id" }).Select(x => "__prices." + x.TrimStart("prices.")).ToArray()) .AddObjectIds(request.Ids) .Build(); var searchResult = await _searchProvider.SearchAsync(KnownDocumentTypes.Product, searchRequest); result.Products = searchResult.Documents.Select(x => _mapper.Map <ExpProduct>(x)).ToList(); return(result); }
public virtual async Task <SearchProductResponse> Handle(SearchProductRequest request, CancellationToken cancellationToken) { var result = new SearchProductResponse(); var searchRequest = new SearchRequestBuilder(_searchPhraseParser) .WithFuzzy(request.Fuzzy) .ParseFilters(request.Filter) .ParseFacets(request.Facet) .WithSearchPhrase(request.Query) .WithPaging(request.Skip, request.Take) .AddSorting(request.Sort) //TODO: Remove hardcoded field name __object from here .WithIncludeFields(request.IncludeFields.Concat(new[] { "id" }).Select(x => "__object." + x).ToArray()) .WithIncludeFields(request.IncludeFields.Where(x => x.StartsWith("prices.")).Concat(new[] { "id" }).Select(x => "__prices." + x.TrimStart("prices.")).ToArray()) .Build(); var searchResult = await _searchProvider.SearchAsync(KnownDocumentTypes.Product, searchRequest); result.Results = searchResult.Documents?.Select(x => _mapper.Map <ExpProduct>(x)).ToList(); result.Facets = searchRequest.Aggregations?.Select(x => _mapper.Map <FacetResult>(x, opts => opts.Items["aggregations"] = searchResult.Aggregations)).ToList(); result.TotalCount = (int)searchResult.TotalCount; return(result); }
public List <Result> Query(Query query) { var searchRequest = SearchRequestBuilder.Parse(query.Search); return(_executor.Execute(searchRequest)); }