public async Task Invoke(HttpContext context) { if (IsValidContext(context)) { SearchOptions searchOptions = GetSearchOptions(context); IIndexSearcher searcher = GetSearcher(); SearchResult searchResult = searcher.Search(searchOptions); context.Response.ContentType = _settings.ResponseContentType; await context.Response.WriteAsync(searchResult.FormatToJson()); } }
public SearchResult Search(SearchOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } var primaryResult = _primarySearcher.Search(options); var secondaryResult = _secondarySearcher.Search(options); SearchResult compositeResult = CreateResult(primaryResult, secondaryResult, options); return(compositeResult); }