Mike Chambers
07/14/2023, 6:43 PMoptions.Validator = new ContentValueSetValidator(true, true, _publicAccessService, _scopeProvider);
is the key I think.
PS this is in 11.3.1D_Inventor
07/17/2023, 5:39 AMD_Inventor
07/17/2023, 5:40 AMIUmbracoContentValueSetBuilder
iircMike Chambers
07/17/2023, 8:41 AMbuilder.Services.AddSingleton<IIndexPopulator, ProductsIndexPopulator>();
was all that was required. and that the configure by options approach maped the populator by index name?Mike Chambers
07/17/2023, 8:45 AMUmbracoContextIndex
, seems a little cleaner. Think this way also means that we inherit the improvements/actions for when content/ancestor is un-protected to update the index.D_Inventor
07/17/2023, 10:04 AMUmbracoContentIndex
, it's automatically picked up by the built-in populator of UmbracoMike Chambers
07/17/2023, 10:05 AMMike Chambers
07/17/2023, 10:06 AMD_Inventor
07/17/2023, 10:06 AMD_Inventor
07/17/2023, 10:07 AMMike Chambers
07/17/2023, 10:15 AM__NodeTypeAlias
there. (as is suggested in the docs that suggest best practise is just to work within the core implemented indexes though not sure how with the omission of any protected content in the external index.. perhaps the external index should default index protected and we should also filter for not protected as required, if it even flags protected??)D_Inventor
07/17/2023, 10:23 AMMike Chambers
07/17/2023, 10:24 AMD_Inventor
07/17/2023, 10:24 AMMike Chambers
07/17/2023, 10:25 AMMike Chambers
07/17/2023, 10:25 AMMike Chambers
07/17/2023, 10:25 AMHi there @aguyfromdenmark, we have no plans to include protected nodes in the index by default or by configurations at this point.
D_Inventor
07/17/2023, 10:26 AMMike Chambers
07/17/2023, 10:26 AMMike Chambers
07/17/2023, 10:27 AMMike Chambers
07/17/2023, 10:29 AMcsharp
using Examine.Lucene;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Infrastructure.Examine;
namespace Umbraco.Docs.Samples.Web.CustomIndexing
{
public class ConfigureExternalIndexOptions : IConfigureNamedOptions<LuceneDirectoryIndexOptions>
{
public void Configure(string name, LuceneDirectoryIndexOptions options)
{
if (name.Equals(Constants.UmbracoIndexes.ExternalIndexName))
{
options.Validator = new ContentValueSetValidator(true, true, _publicAccessService, _scopeProvider);
}
}
// Part of the interface, but does not need to be implemented for this.
public void Configure(LuceneDirectoryIndexOptions options)
{
throw new System.NotImplementedException();
}
}
}
Mike Chambers
07/17/2023, 10:29 AMD_Inventor
07/17/2023, 10:31 AMMike Chambers
07/17/2023, 10:31 AMD_Inventor
07/17/2023, 10:31 AMMike Chambers
07/17/2023, 10:32 AMMike Chambers
07/17/2023, 10:32 AMD_Inventor
07/17/2023, 10:36 AMMike Chambers
07/17/2023, 10:36 AMMike Chambers
07/17/2023, 10:37 AMD_Inventor
07/17/2023, 10:37 AMMike Chambers
07/17/2023, 10:38 AMD_Inventor
07/17/2023, 10:40 AMD_Inventor
07/17/2023, 10:41 AMMike Chambers
07/17/2023, 10:42 AMMike Chambers
07/17/2023, 10:42 AMMike Chambers
07/17/2023, 10:42 AM_publicAccessService.IsProtected(content.Path);
??D_Inventor
07/17/2023, 10:43 AMMike Chambers
07/17/2023, 10:44 AMpublic bool ValidateProtectedContent(string path, string category)
{
if (category == IndexTypes.Content && !SupportProtectedContent)
{
//if the service is null we can't look this up so we'll return false
if (_publicAccessService == null || _scopeProvider == null)
{
return false;
}
// explicit scope since we may be in a background thread
using (_scopeProvider.CreateScope(autoComplete: true))
{
if (_publicAccessService.IsProtected(path).Success)
{
return false;
}
}
}
return true;
}
Mike Chambers
07/17/2023, 10:45 AMMike Chambers
07/17/2023, 10:50 AM_publicAccessRepository
looks like the store.Mike Chambers
07/17/2023, 11:00 AMD_Inventor
07/17/2023, 11:02 AMMike Chambers
07/17/2023, 11:03 AM