Add support for indexing protected nodes in the External index #12560
Replies: 3 comments 1 reply
-
Hi there @aguyfromdenmark, we have no plans to include protected nodes in the index by default or by configurations at this point. I've found some examples for v9 that might help you until we have more documentation
For further questions, make sure to head on over to https://our.umbraco.com and ask follow up questions there! 👍 |
Beta Was this translation helpful? Give feedback.
-
In Umbraco 8 it was something like the following to index protected content
|
Beta Was this translation helpful? Give feedback.
-
think this should do it to support protected in the using Examine;
using Examine.Lucene;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Examine;
namespace www.Extensions.Examine
{
public sealed class ConfigureExamineIndexOptions : IConfigureNamedOptions<LuceneDirectoryIndexOptions>
{
public readonly IPublicAccessService _publicAccessService;
[Obsolete("Update when Umbraco Core ContentValueSetValidator is updated")]
private readonly IScopeProvider _scopeProvider;
[Obsolete("Update when Umbraco Core ContentValueSetValidator is updated")]
public ConfigureExamineIndexOptions(IPublicAccessService publicAccessService, IScopeProvider scopeProvider)
{
_publicAccessService = publicAccessService;
_scopeProvider = scopeProvider;
}
[Obsolete("Update when Umbraco Core ContentValueSetValidator is updated")]
public void Configure(string? name, LuceneDirectoryIndexOptions options)
{
bool supportProtectedContent = true;
switch (name)
{
//NB you need to rebuild the examine index for these changes to take effect
case Constants.UmbracoIndexes.ExternalIndexName:
options.Validator = new ContentValueSetValidator(true, supportProtectedContent, _publicAccessService, _scopeProvider);
break;
}
}
public void Configure(LuceneDirectoryIndexOptions options)
=> throw new NotImplementedException("This is never called and is just part of the interface");
}
public class ConfigureExamineIndexOptionsComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
// Custom Examine configuration
builder.Services.ConfigureOptions<ConfigureExamineIndexOptions>();
}
}
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
There should be a simple way to make the External index index protected nodes. Maybe a flag in the appSettings file.
Umbraco CMS is a great foundation for an intranet type application, and it's fairly easy to add and modify content in the External index to quickly implement search functionality. But the External index becomes useless when you protect your website.
This issue is made worse by the lack of guides/tutorials for creating a custom index in Umbraco v9, let alone one that shows how to index protected content.
Beta Was this translation helpful? Give feedback.
All reactions