Class ContentValueSetValidator
Used to validate a ValueSet for content/media - based on permissions, parent id, etc....
Namespace: Umbraco.Cms.Infrastructure.Examine
Assembly: Umbraco.Infrastructure.dll
Syntax
public class ContentValueSetValidator : ValueSetValidator, IContentValueSetValidator, IValueSetValidator
Constructors
View SourceContentValueSetValidator(bool, bool, IPublicAccessService?, IScopeProvider?, int?, IEnumerable<string>?, IEnumerable<string>?, IEnumerable<string>?, IEnumerable<string>?)
Initializes a new instance of the ContentValueSetValidator class.
Declaration
public ContentValueSetValidator(bool publishedValuesOnly, bool supportProtectedContent, IPublicAccessService? publicAccessService, IScopeProvider? scopeProvider, int? parentId = null, IEnumerable<string>? includeItemTypes = null, IEnumerable<string>? excludeItemTypes = null, IEnumerable<string>? includeFields = null, IEnumerable<string>? excludeFields = null)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | publishedValuesOnly | If |
| bool | supportProtectedContent | If |
| IPublicAccessService | publicAccessService | The service used to check public access permissions. May be |
| IScopeProvider | scopeProvider | The provider for managing database scopes. May be |
| int? | parentId | Optional parent content ID to filter by. Defaults to |
| IEnumerable<string> | includeItemTypes | Optional collection of item types to include in validation. Defaults to |
| IEnumerable<string> | excludeItemTypes | Optional collection of item types to exclude from validation. Defaults to |
| IEnumerable<string> | includeFields | Optional collection of field names to include in validation. Defaults to |
| IEnumerable<string> | excludeFields | Optional collection of field names to exclude from validation. Defaults to |
Properties
View SourceParentId
Gets the identifier of the parent content item, if available.
Declaration
public int? ParentId { get; }
Property Value
| Type | Description |
|---|---|
| int? |
PublishedValuesOnly
Gets a value indicating whether the validator includes only published content values.
Declaration
public bool PublishedValuesOnly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
SupportProtectedContent
Gets a value indicating whether this validator supports protected content.
Declaration
public bool SupportProtectedContent { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ValidIndexCategories
Declaration
protected override IEnumerable<string> ValidIndexCategories { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> |
Methods
View SourceValidate(ValueSet)
Validates the specified Umbraco.Cms.Core.Models.ValueSet to determine if it meets the requirements for indexing in Examine.
Validation includes checks for published status (including culture variants), the presence and validity of the content path, and whether the content is in the recycle bin or protected. If the value set fails any of these checks, it is either marked as failed (not indexable) or filtered (excluded from the index), depending on the nature of the issue.
Declaration
public override ValueSetValidationResult Validate(ValueSet valueSet)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueSet | valueSet | The Umbraco.Cms.Core.Models.ValueSet to validate. |
Returns
| Type | Description |
|---|---|
| ValueSetValidationResult | A Umbraco.Cms.Infrastructure.Examine.ValueSetValidationResult indicating the outcome of the validation:
|
ValidatePath(string, string)
Determines whether the specified path represents a descendant of the configured parent, based on the provided category.
Declaration
public bool ValidatePath(string path, string category)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | The comma-delimited string representing the content path to validate. |
| string | category | The category of the content, used for validation context. |
Returns
| Type | Description |
|---|---|
| bool |
|
ValidateProtectedContent(string, string)
Determines whether the content at the specified path is allowed to be indexed based on its protection status and the given category.
Declaration
public bool ValidateProtectedContent(string path, string category)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | The content path to check for protection. |
| string | category | The category of the content, typically the index type (e.g., |
Returns
| Type | Description |
|---|---|
| bool |
|
ValidateRecycleBin(string, string)
Determines whether the specified path is outside of the recycle bin for the given category.
Declaration
public bool ValidateRecycleBin(string path, string category)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | The comma-delimited path string to validate. |
| string | category | The category (e.g., content or media) used to determine the appropriate recycle bin. |
Returns
| Type | Description |
|---|---|
| bool |
|