Issue 12551 search bug
Previous optimisation incorrectly filtered the index fields needed to return published results
This commit is contained in:
committed by
Nikolaj Geisle
parent
af7d9db32b
commit
ce568343ab
@@ -24,6 +24,9 @@ public class PublishedContentQuery : IPublishedContentQuery
|
||||
private readonly IPublishedSnapshot _publishedSnapshot;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
|
||||
private static readonly HashSet<string> s_returnedQueryFields =
|
||||
new() { ExamineFieldNames.ItemIdFieldName, ExamineFieldNames.CategoryFieldName };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublishedContentQuery" /> class.
|
||||
/// </summary>
|
||||
@@ -293,8 +296,8 @@ public class PublishedContentQuery : IPublishedContentQuery
|
||||
ordering = query.ManagedQuery(term, fields);
|
||||
}
|
||||
|
||||
// Only select item ID field, because results are loaded from the published snapshot based on this single value
|
||||
IOrdering? queryExecutor = ordering.SelectFields(_itemIdFieldNameHashSet);
|
||||
// Filter selected fields because results are loaded from the published snapshot based on these
|
||||
IOrdering? queryExecutor = ordering.SelectFields(s_returnedQueryFields);
|
||||
|
||||
|
||||
ISearchResults? results = skip == 0 && take == 0
|
||||
@@ -328,8 +331,8 @@ public class PublishedContentQuery : IPublishedContentQuery
|
||||
|
||||
if (query is IOrdering ordering)
|
||||
{
|
||||
// Only select item ID field, because results are loaded from the published snapshot based on this single value
|
||||
query = ordering.SelectFields(_itemIdFieldNameHashSet);
|
||||
// Filter selected fields because results are loaded from the published snapshot based on these
|
||||
query = ordering.SelectFields(s_returnedQueryFields);
|
||||
}
|
||||
|
||||
ISearchResults? results = skip == 0 && take == 0
|
||||
|
||||
Reference in New Issue
Block a user