diff --git a/src/JsonSchema/AppSettings.cs b/src/JsonSchema/AppSettings.cs
index b491ed2052..4abca7633e 100644
--- a/src/JsonSchema/AppSettings.cs
+++ b/src/JsonSchema/AppSettings.cs
@@ -51,6 +51,7 @@ namespace JsonSchema
public ImagingSettings? Imaging { get; set; }
public IndexCreatorSettings? Examine { get; set; }
+ public IndexingSettings? Indexing { get; set; }
public KeepAliveSettings? KeepAlive { get; set; }
diff --git a/src/Umbraco.Core/Configuration/Models/IndexingSettings.cs b/src/Umbraco.Core/Configuration/Models/IndexingSettings.cs
new file mode 100644
index 0000000000..2a94a406d1
--- /dev/null
+++ b/src/Umbraco.Core/Configuration/Models/IndexingSettings.cs
@@ -0,0 +1,18 @@
+using System.ComponentModel;
+
+namespace Umbraco.Cms.Core.Configuration.Models;
+
+///
+/// Typed configuration options for index creator settings.
+///
+[UmbracoOptions(Constants.Configuration.ConfigIndexing)]
+public class IndexingSettings
+{
+ private const bool StaticExplicitlyIndexEachNestedProperty = true;
+
+ ///
+ /// Gets or sets a value for whether each nested property should have it's own indexed value. Requires a rebuild of indexes when changed.
+ ///
+ [DefaultValue(StaticExplicitlyIndexEachNestedProperty)]
+ public bool ExplicitlyIndexEachNestedProperty { get; set; } = StaticExplicitlyIndexEachNestedProperty;
+}
diff --git a/src/Umbraco.Core/Constants-Configuration.cs b/src/Umbraco.Core/Constants-Configuration.cs
index fea3ceecbf..a7cd0156ac 100644
--- a/src/Umbraco.Core/Constants-Configuration.cs
+++ b/src/Umbraco.Core/Constants-Configuration.cs
@@ -38,6 +38,7 @@ public static partial class Constants
public const string ConfigHosting = ConfigPrefix + "Hosting";
public const string ConfigImaging = ConfigPrefix + "Imaging";
public const string ConfigExamine = ConfigPrefix + "Examine";
+ public const string ConfigIndexing = ConfigPrefix + "Indexing";
public const string ConfigKeepAlive = ConfigPrefix + "KeepAlive";
public const string ConfigLogging = ConfigPrefix + "Logging";
public const string ConfigMemberPassword = ConfigPrefix + "Security:MemberPassword";
diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
index da49cf68fc..4caf854d60 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
@@ -50,6 +50,7 @@ public static partial class UmbracoBuilderExtensions
builder
.AddUmbracoOptions()
.AddUmbracoOptions()
+ .AddUmbracoOptions()
.AddUmbracoOptions()
.AddUmbracoOptions()
.AddUmbracoOptions()
@@ -64,7 +65,7 @@ public static partial class UmbracoBuilderExtensions
.AddUmbracoOptions()
.AddUmbracoOptions()
.AddUmbracoOptions()
- .AddUmbracoOptions()
+ .AddUmbracoOptions()
.AddUmbracoOptions()
.AddUmbracoOptions()
.AddUmbracoOptions()
diff --git a/src/Umbraco.Core/PropertyEditors/JsonPropertyIndexValueFactoryBase.cs b/src/Umbraco.Core/PropertyEditors/JsonPropertyIndexValueFactoryBase.cs
index a56bf0ed88..bf549e2d2e 100644
--- a/src/Umbraco.Core/PropertyEditors/JsonPropertyIndexValueFactoryBase.cs
+++ b/src/Umbraco.Core/PropertyEditors/JsonPropertyIndexValueFactoryBase.cs
@@ -1,5 +1,9 @@
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
+using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Serialization;
+using Umbraco.Cms.Web.Common.DependencyInjection;
using Umbraco.Extensions;
namespace Umbraco.Cms.Core.PropertyEditors;
@@ -11,13 +15,28 @@ namespace Umbraco.Cms.Core.PropertyEditors;
public abstract class JsonPropertyIndexValueFactoryBase : IPropertyIndexValueFactory
{
private readonly IJsonSerializer _jsonSerializer;
+ private IndexingSettings _indexingSettings;
+
+ protected bool ForceExplicitlyIndexEachNestedProperty { get; set; }
///
/// Constructor for the JsonPropertyIndexValueFactoryBase.
///
- protected JsonPropertyIndexValueFactoryBase(IJsonSerializer jsonSerializer)
+ protected JsonPropertyIndexValueFactoryBase(IJsonSerializer jsonSerializer, IOptionsMonitor indexingSettings)
{
_jsonSerializer = jsonSerializer;
+ _indexingSettings = indexingSettings.CurrentValue;
+ indexingSettings.OnChange(newValue => _indexingSettings = newValue);
+ }
+
+
+ ///
+ /// Constructor for the JsonPropertyIndexValueFactoryBase.
+ ///
+ [Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
+ protected JsonPropertyIndexValueFactoryBase(IJsonSerializer jsonSerializer): this(jsonSerializer, StaticServiceProvider.Instance.GetRequiredService>())
+ {
+
}
///
@@ -58,9 +77,14 @@ public abstract class JsonPropertyIndexValueFactoryBase : IProperty
}
}
- result.AddRange(HandleResume(result, property, culture, segment, published));
+ IEnumerable>> summary = HandleResume(result, property, culture, segment, published);
+ if (_indexingSettings.ExplicitlyIndexEachNestedProperty || ForceExplicitlyIndexEachNestedProperty)
+ {
+ result.AddRange(summary);
+ return result;
+ }
- return result;
+ return summary;
}
[Obsolete("Use method overload that has availableCultures, scheduled for removal in v14")]
@@ -68,7 +92,7 @@ public abstract class JsonPropertyIndexValueFactoryBase : IProperty
=> GetIndexValues(property, culture, segment, published, Enumerable.Empty());
///
- /// Method to return a list of resume of the content. By default this returns an empty list
+ /// Method to return a list of summary of the content. By default this returns an empty list
///
protected virtual IEnumerable>> HandleResume(
List>> result,
diff --git a/src/Umbraco.Core/PropertyEditors/TagPropertyIndexValueFactory.cs b/src/Umbraco.Core/PropertyEditors/TagPropertyIndexValueFactory.cs
index b3a8e9a2b8..f858b6801a 100644
--- a/src/Umbraco.Core/PropertyEditors/TagPropertyIndexValueFactory.cs
+++ b/src/Umbraco.Core/PropertyEditors/TagPropertyIndexValueFactory.cs
@@ -1,12 +1,27 @@
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
+using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Serialization;
+using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Core.PropertyEditors;
public class TagPropertyIndexValueFactory : JsonPropertyIndexValueFactoryBase, ITagPropertyIndexValueFactory
{
- public TagPropertyIndexValueFactory(IJsonSerializer jsonSerializer) : base(jsonSerializer)
+ public TagPropertyIndexValueFactory(
+ IJsonSerializer jsonSerializer,
+ IOptionsMonitor indexingSettings)
+ : base(jsonSerializer, indexingSettings)
{
+ ForceExplicitlyIndexEachNestedProperty = true;
+ }
+
+ [Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
+ public TagPropertyIndexValueFactory(IJsonSerializer jsonSerializer)
+ : this(jsonSerializer, StaticServiceProvider.Instance.GetRequiredService>())
+ {
+
}
protected override IEnumerable>> Handle(
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyIndexValueFactory.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyIndexValueFactory.cs
index dfedeedc3f..adace6126e 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyIndexValueFactory.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyIndexValueFactory.cs
@@ -1,10 +1,14 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
+using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
+using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Core.PropertyEditors;
@@ -14,12 +18,22 @@ internal sealed class BlockValuePropertyIndexValueFactory :
{
private readonly IContentTypeService _contentTypeService;
+ public BlockValuePropertyIndexValueFactory(
+ PropertyEditorCollection propertyEditorCollection,
+ IContentTypeService contentTypeService,
+ IJsonSerializer jsonSerializer,
+ IOptionsMonitor indexingSettings)
+ : base(propertyEditorCollection, jsonSerializer, indexingSettings)
+ {
+ _contentTypeService = contentTypeService;
+ }
+ [Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
public BlockValuePropertyIndexValueFactory(
PropertyEditorCollection propertyEditorCollection,
IContentTypeService contentTypeService,
IJsonSerializer jsonSerializer)
- : base(propertyEditorCollection, jsonSerializer)
+ : this(propertyEditorCollection, contentTypeService, jsonSerializer, StaticServiceProvider.Instance.GetRequiredService>())
{
_contentTypeService = contentTypeService;
}
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyIndexValueFactory.cs b/src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyIndexValueFactory.cs
index 445e1cc361..121a40bec9 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyIndexValueFactory.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyIndexValueFactory.cs
@@ -1,9 +1,13 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
+using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
+using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Core.PropertyEditors;
@@ -15,11 +19,22 @@ internal sealed class NestedContentPropertyIndexValueFactory
{
private readonly IContentTypeService _contentTypeService;
-
public NestedContentPropertyIndexValueFactory(
PropertyEditorCollection propertyEditorCollection,
IContentTypeService contentTypeService,
- IJsonSerializer jsonSerializer) : base(propertyEditorCollection, jsonSerializer)
+ IJsonSerializer jsonSerializer,
+ IOptionsMonitor indexingSettings)
+ : base(propertyEditorCollection, jsonSerializer, indexingSettings)
+ {
+ _contentTypeService = contentTypeService;
+ }
+
+ [Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
+ public NestedContentPropertyIndexValueFactory(
+ PropertyEditorCollection propertyEditorCollection,
+ IContentTypeService contentTypeService,
+ IJsonSerializer jsonSerializer)
+ : this(propertyEditorCollection, contentTypeService, jsonSerializer, StaticServiceProvider.Instance.GetRequiredService>())
{
_contentTypeService = contentTypeService;
}
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/NestedPropertyIndexValueFactoryBase.cs b/src/Umbraco.Infrastructure/PropertyEditors/NestedPropertyIndexValueFactoryBase.cs
index b3799aaa95..94ed0a3e15 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/NestedPropertyIndexValueFactoryBase.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/NestedPropertyIndexValueFactoryBase.cs
@@ -1,7 +1,11 @@
using System.Text;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
+using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Infrastructure.Examine;
+using Umbraco.Cms.Web.Common.DependencyInjection;
using Umbraco.Extensions;
namespace Umbraco.Cms.Core.PropertyEditors;
@@ -10,12 +14,23 @@ internal abstract class NestedPropertyIndexValueFactoryBase
{
private readonly PropertyEditorCollection _propertyEditorCollection;
+
+ protected NestedPropertyIndexValueFactoryBase(
+ PropertyEditorCollection propertyEditorCollection,
+ IJsonSerializer jsonSerializer,
+ IOptionsMonitor indexingSettings)
+ : base(jsonSerializer, indexingSettings)
+ {
+ _propertyEditorCollection = propertyEditorCollection;
+ }
+
+ [Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
protected NestedPropertyIndexValueFactoryBase(
PropertyEditorCollection propertyEditorCollection,
IJsonSerializer jsonSerializer)
- : base(jsonSerializer)
+ : this(propertyEditorCollection, jsonSerializer, StaticServiceProvider.Instance.GetRequiredService>())
{
- _propertyEditorCollection = propertyEditorCollection;
+
}
[Obsolete("Use the overload that specifies availableCultures, scheduled for removal in v14")]