public async Task <SearchQueryViewModel> GetTopSearchQueryViewModelAsync(SearchQueryType queryType, string queryName, int pageSize) { if (_topResultsViewModel != null && _topResultsViewModel.QueryName == queryName && _topResultsViewModel.QueryType == queryType) { return(_topResultsViewModel); } var criteria = BuildProductsSearchCriteria(); criteria.NumberOfItemsPerPage = pageSize; var param = new GetSearchQueryViewModelParams { QueryName = queryName, QueryType = queryType, Scope = ComposerContext.Scope, CultureInfo = ComposerContext.CultureInfo, Criteria = criteria, InventoryLocationIds = criteria.InventoryLocationIds }; _topResultsViewModel = await SearchQueryViewService.GetSearchQueryViewModelAsync(param).ConfigureAwait(false); if (_topResultsViewModel.ProductSearchResults.Pagination != null) { _topResultsViewModel.ProductSearchResults.Pagination.TotalNumberOfPages = 1; _topResultsViewModel.ProductSearchResults.Pagination.NextPage = null; } return(_topResultsViewModel); }
/// <summary> /// Sets type of Search query. /// </summary> /// <typeparam name="TEntity">The type of the entity.</typeparam> /// <param name="query">The query.</param> /// <param name="queryType">Type of the query.</param> /// <returns>Query.</returns> public static IODataQueryable <TEntity> QueryType <TEntity>( this IODataQueryable <TEntity> query, SearchQueryType queryType) { var result = new AzureQueryable <TEntity>(query) { QueryType = queryType }; return(result); }
internal static string GetValue(this SearchQueryType searchQueryType) { // TODO change this to switch expression when C# 8 is gold switch (searchQueryType) { case SearchQueryType.DMQL: return("DMQL"); case SearchQueryType.DMQL2: return("DMQL2"); default: throw new Exception($"Unknown SearchQueryType encountered: {searchQueryType}"); } }
public void UpdateSearchQuery(SearchQueryType queryType) { m_CurrentSearchType = queryType; if (!m_SearchQueries.ContainsKey(queryType)) { switch (queryType) { case SearchQueryType.Artist: m_SearchQueries.Add(queryType, new SearchQueryArtist(this)); break; case SearchQueryType.Playlist: m_SearchQueries.Add(queryType, new SearchQueryPlaylist(this)); break; } } OnPropertyChanged(nameof(SearchQuery)); }
public async Task <SearchQueryViewModel> GetSearchQueryViewModelAsync(SearchQueryType queryType, string queryName) { if (_viewModel != null && _viewModel.QueryName == queryName && _viewModel.QueryType == queryType) { return(_viewModel); } var criteria = BuildProductsSearchCriteria(); var param = new GetSearchQueryViewModelParams { QueryName = queryName, QueryType = queryType, Scope = ComposerContext.Scope, CultureInfo = ComposerContext.CultureInfo, Criteria = criteria, InventoryLocationIds = criteria.InventoryLocationIds }; _viewModel = await SearchQueryViewService.GetSearchQueryViewModelAsync(param).ConfigureAwait(false); return(_viewModel); }
public static string ToSerialString(this SearchQueryType value) => value switch {
public static string ToSerialString(this SearchQueryType value) => SearchQueryTypeExtensions.ToSerialString(value);