Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentValueSetValidator

    Used to validate a ValueSet for content/media - based on permissions, parent id, etc....

    Inheritance
    object
    ValueSetValidator
    Namespace: Umbraco.Cms.Infrastructure.Examine
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public class ContentValueSetValidator : ValueSetValidator, IContentValueSetValidator, IValueSetValidator

    Constructors

    View Source

    ContentValueSetValidator(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 true, only published values are validated.

    bool supportProtectedContent

    If true, enables validation of protected content.

    IPublicAccessService publicAccessService

    The service used to check public access permissions. May be null.

    IScopeProvider scopeProvider

    The provider for managing database scopes. May be null.

    int? parentId

    Optional parent content ID to filter by. Defaults to null.

    IEnumerable<string> includeItemTypes

    Optional collection of item types to include in validation. Defaults to null (all types included).

    IEnumerable<string> excludeItemTypes

    Optional collection of item types to exclude from validation. Defaults to null.

    IEnumerable<string> includeFields

    Optional collection of field names to include in validation. Defaults to null (all fields included).

    IEnumerable<string> excludeFields

    Optional collection of field names to exclude from validation. Defaults to null.

    Properties

    View Source

    ParentId

    Gets the identifier of the parent content item, if available.

    Declaration
    public int? ParentId { get; }
    Property Value
    Type Description
    int?
    View Source

    PublishedValuesOnly

    Gets a value indicating whether the validator includes only published content values.

    Declaration
    public bool PublishedValuesOnly { get; }
    Property Value
    Type Description
    bool
    View Source

    SupportProtectedContent

    Gets a value indicating whether this validator supports protected content.

    Declaration
    public bool SupportProtectedContent { get; }
    Property Value
    Type Description
    bool
    View Source

    ValidIndexCategories

    Declaration
    protected override IEnumerable<string> ValidIndexCategories { get; }
    Property Value
    Type Description
    IEnumerable<string>

    Methods

    View Source

    Validate(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:

    • Valid: The value set passed all checks and is suitable for indexing.
    • Filtered: The value set should be excluded from the index due to path, recycle bin, or protected content rules.
    • Failed: The value set is invalid (for example, missing required fields) and cannot be indexed.
    The result may also contain a filtered version of the original value set with unpublished culture variants removed.
    View Source

    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

    true if the path contains the parent ID and is considered valid; otherwise, false.

    View Source

    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., IndexTypes.Content).

    Returns
    Type Description
    bool

    true if the content is not protected, protection is not supported, or the category does not require protection checks; otherwise, false.

    View Source

    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

    true if path does not include the recycle bin for the specified category (when PublishedValuesOnly is true); otherwise, false.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX