Skip to content

Commit

Permalink
Fixed issues in SqlQueryGenerator and rollback unnecessary change in …
Browse files Browse the repository at this point in the history
…SortRewriter
  • Loading branch information
almostchristian committed Oct 19, 2023
1 parent 82c33ec commit 3ee3f57
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ public class CoreFeatureConfiguration
/// <summary>
/// Gets or sets a value indicating whether the sql generator should use OFFSET for paging search results.
/// </summary>
public bool SupportsIndexedPaging { get; set; } = true;
public bool SupportsIndexedPaging { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Microsoft.Health.Fhir.Shared.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"ProfileValidationOnUpdate": false,
"SupportsResourceChangeCapture": false,
"SupportsBulkDelete": true,
"SupportsIndexedPaging": false,
"Versioning": {
"Default": "versioned",
"ResourceTypeOverrides": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public override object VisitSqlRoot(SqlRootExpression expression, SearchOptions
// DISTINCT is used since different ctes may return the same resources due to _include and _include:iterate search parameters
StringBuilder.Append("SELECT DISTINCT ");

if (!context.UseIndexedPaging && expression.SearchParamTableExpressions.Count == 0)
if (!searchOptions.UseIndexedPaging && expression.SearchParamTableExpressions.Count == 0)
{
StringBuilder.Append("TOP (").Append(Parameters.AddParameter(context.MaxItemCount + 1, includeInHash: false)).Append(") ");
}
Expand Down Expand Up @@ -792,7 +792,7 @@ private void HandleTableKindInclude(

StringBuilder.Append("SELECT DISTINCT ");

if (includeExpression.Reversed && context.UseIndexedPaging)
if (includeExpression.Reversed)
{
// In case its revinclude, we limit the number of returned items as the resultset size is potentially
// unbounded. we ask for +1 so in the limit expression we know if to mark at truncated...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ public override Expression VisitSqlRoot(SqlRootExpression expression, SqlSearchO
// for resources that have a value for the _sort parameter. So we will generate
// the appropriate Sort expression below.
}
else if ((continuationToken != null && continuationToken.SortValue == null) ||
(continuationToken == null && context.Sort[0].sortOrder == SortOrder.Ascending))
else if (continuationToken != null && continuationToken.SortValue == null)
{
// We have a ct for resourceid but not for the sort value.
// This means we are paging through resources that do not have values for the _sort parameter.
Expand Down

0 comments on commit 3ee3f57

Please sign in to comment.