Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Marius 15 posts 102 karma points
    Mar 30, 2023 @ 15:54
    Marius
    1

    How to enable SupportProtectedContent for external index?

    How to enable SupportProtectedContent for an external index in Umbraco 11?

  • Marc Love (uSkinned.net) 431 posts 1669 karma points
    Mar 31, 2023 @ 10:18
    Marc Love (uSkinned.net)
    102

    Hi Marius,

    You need to customise the External Index.

    See here:

    https://docs.umbraco.com/umbraco-cms/reference/searching/examine/indexing#creating-a-configureoptions-class

    Inside the Configure method:

    if (name.Equals(Constants.UmbracoIndexes.ExternalIndexName))
    {
         options.Validator = new ContentValueSetValidator(true, true, _publicAccessService, _scopeProvider, null, null);
    }
    

    setting second parameter of ContentValueSetValidator to true enables SupportProtectedContent.

    Cheers,

    Marc

  • Marius 15 posts 102 karma points
    Mar 31, 2023 @ 14:55
    Marius
    0

    Thanks that solved my problem

  • Marc Love (uSkinned.net) 431 posts 1669 karma points
    Mar 31, 2023 @ 15:09
    Marc Love (uSkinned.net)
    0

    Great, thanks for letting me know that worked.

  • roger malik 16 posts 78 karma points
    17 days ago
    roger malik
    0

    IComposer is called from startup.cs and it won't let you get to the _publicAccessService in start-up, so how have you managed to get this working ?

  • Marc Love (uSkinned.net) 431 posts 1669 karma points
    16 days ago
    Marc Love (uSkinned.net)
    0

    Hi Roger,

    In you class that inherits from IComposer add the following:

    //Custom Examine configuration
    builder.Services.ConfigureOptions<ConfigureIndexOptions>();
    

    Create a new class:

    public sealed class ConfigureIndexOptions : IConfigureNamedOptions<LuceneDirectoryIndexOptions>
    

    Inject IPublicAccessService in your constructor.

    Let me know if that helps.

    Cheers,

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft