Skip to content

Commit

Permalink
Disable Sort for Summary Count (#4728)
Browse files Browse the repository at this point in the history
* disable sort for summary count

* disable sort logic for count only
  • Loading branch information
mikaelweave authored Nov 16, 2024
1 parent 449af6a commit 6712d82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ public SearchOptions Create(
searchOptions.UnsupportedSearchParams = unsupportedSearchParameters;

var searchSortErrors = new List<string>();
if (searchParams.Sort?.Count > 0)

// Sort is unneded for summary count
if (searchParams.Sort?.Count > 0 && searchParams.Summary != SummaryType.Count)
{
var sortings = new List<(SearchParameterInfo, SortOrder)>(searchParams.Sort.Count);
bool sortingsValid = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public override async Task<SearchResult> SearchAsync(SearchOptions searchOptions
// We seem to have run a sort which has returned less results than what max we can return.
// Let's determine whether we need to execute another query or not.
if ((sqlSearchOptions.Sort[0].sortOrder == SortOrder.Ascending && sqlSearchOptions.DidWeSearchForSortValue.HasValue && !sqlSearchOptions.DidWeSearchForSortValue.Value) ||
(sqlSearchOptions.Sort[0].sortOrder == SortOrder.Descending && sqlSearchOptions.DidWeSearchForSortValue.HasValue && sqlSearchOptions.DidWeSearchForSortValue.Value && !sqlSearchOptions.SortHasMissingModifier) || (sqlSearchOptions.Sort[0].sortOrder == SortOrder.Descending && resultCount == 0))
(sqlSearchOptions.Sort[0].sortOrder == SortOrder.Descending && sqlSearchOptions.DidWeSearchForSortValue.HasValue && sqlSearchOptions.DidWeSearchForSortValue.Value && !sqlSearchOptions.SortHasMissingModifier) || (sqlSearchOptions.Sort[0].sortOrder == SortOrder.Descending && resultCount == 0 && !sqlSearchOptions.CountOnly))
{
if (sqlSearchOptions.MaxItemCount - resultCount == 0)
{
Expand Down

0 comments on commit 6712d82

Please sign in to comment.