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) 447 posts 1790 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) 447 posts 1790 karma points
    Mar 31, 2023 @ 15:09
    Marc Love (uSkinned.net)
    0

    Great, thanks for letting me know that worked.

  • roger malik 17 posts 79 karma points
    Apr 02, 2024 @ 21:11
    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) 447 posts 1790 karma points
    Apr 03, 2024 @ 08:06
    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

  • Bartosz Szadach 13 posts 77 karma points
    Aug 01, 2024 @ 09:48
    Bartosz Szadach
    0

    Do anyone know how to do it in Umbraco 13? Constructor with IScopeProvider is obsolete. Thanks!

  • Marc Love (uSkinned.net) 447 posts 1790 karma points
    Aug 01, 2024 @ 10:58
    Marc Love (uSkinned.net)
    0

    Hi Bartosz,

    Same approach in Umbraco 13. I do not use IScopeProvider in this example. Where do you think you need to use this?

    Cheers,

    Marc

  • Bartosz Szadach 13 posts 77 karma points
    Aug 01, 2024 @ 11:01
    Bartosz Szadach
    0

    ContentValueSetValidator requires IScopeProvider to be passed into constructor

  • Marc Love (uSkinned.net) 447 posts 1790 karma points
    Aug 01, 2024 @ 11:02
    Marc Love (uSkinned.net)
    0

    I use:

    options.Validator = new ContentValueSetValidator(true, true, _publicAccessService, null, null, null);
    

    This works for me.

  • Bartosz Szadach 13 posts 77 karma points
    Aug 01, 2024 @ 11:03
    Bartosz Szadach
    0

    Will try to, thanks a lot!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies