Skip to content

Commit f1c83fb

Browse files
Only select ItemIdFieldName in PublishedContentQuery.Search to improve performance (#11950)
* Fix code styling * Only select ItemIdFieldName and fix exception when variation context is null * Save hashset instead of making on on each request (indirectly) Co-authored-by: Bjarke Berg <[email protected]>
1 parent 0f4020d commit f1c83fb

File tree

2 files changed

+132
-130
lines changed

2 files changed

+132
-130
lines changed

src/Umbraco.Infrastructure/IPublishedContentQuery.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Xml.XPath;
44
using Examine.Search;
@@ -8,31 +8,46 @@
88
namespace Umbraco.Cms.Core
99
{
1010
/// <summary>
11-
/// Query methods used for accessing strongly typed content in templates
11+
/// Query methods used for accessing strongly typed content in templates.
1212
/// </summary>
1313
public interface IPublishedContentQuery
1414
{
1515
IPublishedContent Content(int id);
16+
1617
IPublishedContent Content(Guid id);
18+
1719
IPublishedContent Content(Udi id);
20+
1821
IPublishedContent Content(object id);
22+
1923
IPublishedContent ContentSingleAtXPath(string xpath, params XPathVariable[] vars);
24+
2025
IEnumerable<IPublishedContent> Content(IEnumerable<int> ids);
26+
2127
IEnumerable<IPublishedContent> Content(IEnumerable<Guid> ids);
2228

2329
IEnumerable<IPublishedContent> Content(IEnumerable<object> ids);
30+
2431
IEnumerable<IPublishedContent> ContentAtXPath(string xpath, params XPathVariable[] vars);
32+
2533
IEnumerable<IPublishedContent> ContentAtXPath(XPathExpression xpath, params XPathVariable[] vars);
34+
2635
IEnumerable<IPublishedContent> ContentAtRoot();
2736

2837
IPublishedContent Media(int id);
38+
2939
IPublishedContent Media(Guid id);
40+
3041
IPublishedContent Media(Udi id);
3142

3243
IPublishedContent Media(object id);
44+
3345
IEnumerable<IPublishedContent> Media(IEnumerable<int> ids);
46+
3447
IEnumerable<IPublishedContent> Media(IEnumerable<object> ids);
48+
3549
IEnumerable<IPublishedContent> Media(IEnumerable<Guid> ids);
50+
3651
IEnumerable<IPublishedContent> MediaAtRoot();
3752

3853
/// <summary>
@@ -44,7 +59,7 @@ public interface IPublishedContentQuery
4459
/// <param name="totalRecords">The total amount of records.</param>
4560
/// <param name="culture">The culture (defaults to a culture insensitive search).</param>
4661
/// <param name="indexName">The name of the index to search (defaults to <see cref="Constants.UmbracoIndexes.ExternalIndexName" />).</param>
47-
/// <param name="loadedFields">The fields to load in the results of the search (defaults to all fields loaded).</param>
62+
/// <param name="loadedFields">This parameter is no longer used, because the results are loaded from the published snapshot using the single item ID field.</param>
4863
/// <returns>
4964
/// The search results.
5065
/// </returns>

0 commit comments

Comments
 (0)