diff --git a/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs b/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs
index 5ae43f8d39..52a40b0ee4 100644
--- a/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/IndexCreatorSettings.cs
@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
+using System;
+
namespace Umbraco.Cms.Core.Configuration.Models
{
///
@@ -11,6 +13,7 @@ namespace Umbraco.Cms.Core.Configuration.Models
///
/// Gets or sets a value for lucene directory factory type.
///
- public string LuceneDirectoryFactory { get; set; }
+ public LuceneDirectoryFactory LuceneDirectoryFactory { get; set; }
+
}
}
diff --git a/src/Umbraco.Core/Configuration/Models/LuceneDirectoryFactory.cs b/src/Umbraco.Core/Configuration/Models/LuceneDirectoryFactory.cs
new file mode 100644
index 0000000000..5f06a850f1
--- /dev/null
+++ b/src/Umbraco.Core/Configuration/Models/LuceneDirectoryFactory.cs
@@ -0,0 +1,24 @@
+// Copyright (c) Umbraco.
+// See LICENSE for more details.
+
+namespace Umbraco.Cms.Core.Configuration.Models
+{
+ public enum LuceneDirectoryFactory
+ {
+ ///
+ /// The index will operate from the default location: Umbraco/Data/Temp/ExamineIndexes
+ ///
+ Default,
+
+ ///
+ /// The index will operate on a local index created in the processes %temp% location and
+ /// will replicate back to main storage in Umbraco/Data/Temp/ExamineIndexes
+ ///
+ SyncedTempFileSystemDirectoryFactory,
+
+ ///
+ /// The index will operate only in the processes %temp% directory location
+ ///
+ TempFileSystemDirectoryFactory
+ }
+}
diff --git a/src/Umbraco.Examine.Lucene/ConfigurationEnabledDirectoryFactory.cs b/src/Umbraco.Examine.Lucene/ConfigurationEnabledDirectoryFactory.cs
index e6e2ff9a82..dfed005470 100644
--- a/src/Umbraco.Examine.Lucene/ConfigurationEnabledDirectoryFactory.cs
+++ b/src/Umbraco.Examine.Lucene/ConfigurationEnabledDirectoryFactory.cs
@@ -5,79 +5,61 @@ using System;
using System.IO;
using Examine;
using Examine.Lucene.Directories;
+using Examine.Lucene.Providers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
-using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Configuration.Models;
-using Umbraco.Cms.Core.Hosting;
-using Umbraco.Extensions;
-using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Cms.Infrastructure.Examine
{
- public class ConfigurationEnabledDirectoryFactory : IDirectoryFactory
+ ///
+ /// An Examine directory factory implementation based on configured values
+ ///
+ public class ConfigurationEnabledDirectoryFactory : DirectoryFactoryBase
{
private readonly IServiceProvider _services;
- private readonly ITypeFinder _typeFinder;
- private readonly IHostingEnvironment _hostingEnvironment;
- private readonly ILockFactory _lockFactory;
private readonly IApplicationRoot _applicationRoot;
private readonly IndexCreatorSettings _settings;
+ private IDirectoryFactory _directoryFactory;
public ConfigurationEnabledDirectoryFactory(
IServiceProvider services,
- ITypeFinder typeFinder,
- IHostingEnvironment hostingEnvironment,
- ILockFactory lockFactory,
IOptions settings,
IApplicationRoot applicationRoot)
{
_services = services;
- _typeFinder = typeFinder;
- _hostingEnvironment = hostingEnvironment;
- _lockFactory = lockFactory;
_applicationRoot = applicationRoot;
_settings = settings.Value;
}
- public Lucene.Net.Store.Directory CreateDirectory(string indexName) => CreateFileSystemLuceneDirectory(indexName);
+ protected override Lucene.Net.Store.Directory CreateDirectory(LuceneIndex luceneIndex, bool forceUnlock)
+ {
+ _directoryFactory = CreateFactory();
+ return _directoryFactory.CreateDirectory(luceneIndex, forceUnlock);
+ }
///
- /// Creates a file system based Lucene with the correct locking guidelines for Umbraco
- ///
- ///
- /// The folder name to store the index (single word, not a fully qualified folder) (i.e. Internal)
- ///
- ///
- public virtual Lucene.Net.Store.Directory CreateFileSystemLuceneDirectory(string indexName)
+ /// Creates a directory factory based on the configured value and ensures that
+ ///
+ private IDirectoryFactory CreateFactory()
{
- var dirInfo = _applicationRoot.ApplicationRoot;
+ DirectoryInfo dirInfo = _applicationRoot.ApplicationRoot;
if (!dirInfo.Exists)
{
Directory.CreateDirectory(dirInfo.FullName);
}
- //check if there's a configured directory factory, if so create it and use that to create the lucene dir
- var configuredDirectoryFactory = _settings.LuceneDirectoryFactory;
-
- if (!configuredDirectoryFactory.IsNullOrWhiteSpace())
- {
- //this should be a fully qualified type
- Type factoryType = _typeFinder.GetTypeByName(configuredDirectoryFactory);
- if (factoryType == null)
- {
- throw new InvalidOperationException("No directory type found for value: " + configuredDirectoryFactory);
- }
-
- var directoryFactory = (IDirectoryFactory)ActivatorUtilities.CreateInstance(_services, factoryType);
-
- return directoryFactory.CreateDirectory(indexName);
+ switch (_settings.LuceneDirectoryFactory)
+ {
+ case LuceneDirectoryFactory.SyncedTempFileSystemDirectoryFactory:
+ return _services.GetRequiredService();
+ case LuceneDirectoryFactory.TempFileSystemDirectoryFactory:
+ return _services.GetRequiredService();
+ case LuceneDirectoryFactory.Default:
+ default:
+ return _services.GetRequiredService();
}
-
- var fileSystemDirectoryFactory = new FileSystemDirectoryFactory(dirInfo, _lockFactory);
- return fileSystemDirectoryFactory.CreateDirectory(indexName);
-
}
}
}
diff --git a/src/Umbraco.Examine.Lucene/DependencyInjection/ConfigureIndexOptions.cs b/src/Umbraco.Examine.Lucene/DependencyInjection/ConfigureIndexOptions.cs
index 677167f0ff..7d434cbf23 100644
--- a/src/Umbraco.Examine.Lucene/DependencyInjection/ConfigureIndexOptions.cs
+++ b/src/Umbraco.Examine.Lucene/DependencyInjection/ConfigureIndexOptions.cs
@@ -3,8 +3,10 @@ using Examine;
using Examine.Lucene;
using Examine.Lucene.Analyzers;
using Lucene.Net.Analysis.Standard;
+using Lucene.Net.Index;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
+using Umbraco.Cms.Core.Configuration.Models;
namespace Umbraco.Cms.Infrastructure.Examine.DependencyInjection
{
@@ -14,9 +16,15 @@ namespace Umbraco.Cms.Infrastructure.Examine.DependencyInjection
public sealed class ConfigureIndexOptions : IConfigureNamedOptions
{
private readonly IUmbracoIndexConfig _umbracoIndexConfig;
+ private readonly IOptions _settings;
- public ConfigureIndexOptions(IUmbracoIndexConfig umbracoIndexConfig)
- => _umbracoIndexConfig = umbracoIndexConfig;
+ public ConfigureIndexOptions(
+ IUmbracoIndexConfig umbracoIndexConfig,
+ IOptions settings)
+ {
+ _umbracoIndexConfig = umbracoIndexConfig;
+ _settings = settings;
+ }
public void Configure(string name, LuceneDirectoryIndexOptions options)
{
@@ -38,6 +46,17 @@ namespace Umbraco.Cms.Infrastructure.Examine.DependencyInjection
options.FieldDefinitions = new UmbracoFieldDefinitionCollection();
break;
}
+
+ // ensure indexes are unlocked on startup
+ options.UnlockIndex = true;
+
+ if (_settings.Value.LuceneDirectoryFactory == LuceneDirectoryFactory.SyncedTempFileSystemDirectoryFactory)
+ {
+ // if this directory factory is enabled then a snapshot deletion policy is required
+ options.IndexDeletionPolicy = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
+ }
+
+
}
public void Configure(LuceneDirectoryIndexOptions options)
diff --git a/src/Umbraco.Examine.Lucene/Extensions/ExamineExtensions.cs b/src/Umbraco.Examine.Lucene/Extensions/ExamineExtensions.cs
index 1a8bb36baa..82b43eaa20 100644
--- a/src/Umbraco.Examine.Lucene/Extensions/ExamineExtensions.cs
+++ b/src/Umbraco.Examine.Lucene/Extensions/ExamineExtensions.cs
@@ -10,6 +10,8 @@ using Lucene.Net.Analysis.Core;
using Lucene.Net.Index;
using Lucene.Net.QueryParsers.Classic;
using Microsoft.Extensions.Logging;
+using Umbraco.Cms.Core.Composing;
+using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Runtime;
using Umbraco.Cms.Infrastructure.Examine;
diff --git a/src/Umbraco.Examine.Lucene/LuceneIndexDiagnostics.cs b/src/Umbraco.Examine.Lucene/LuceneIndexDiagnostics.cs
index 6ad23b5992..ebc7d13b58 100644
--- a/src/Umbraco.Examine.Lucene/LuceneIndexDiagnostics.cs
+++ b/src/Umbraco.Examine.Lucene/LuceneIndexDiagnostics.cs
@@ -4,9 +4,11 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Examine.Lucene;
using Examine.Lucene.Providers;
using Lucene.Net.Store;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Hosting;
using Umbraco.Extensions;
@@ -16,10 +18,16 @@ namespace Umbraco.Cms.Infrastructure.Examine
public class LuceneIndexDiagnostics : IIndexDiagnostics
{
private readonly IHostingEnvironment _hostingEnvironment;
+ private readonly LuceneDirectoryIndexOptions _indexOptions;
- public LuceneIndexDiagnostics(LuceneIndex index, ILogger logger, IHostingEnvironment hostingEnvironment)
+ public LuceneIndexDiagnostics(
+ LuceneIndex index,
+ ILogger logger,
+ IHostingEnvironment hostingEnvironment,
+ IOptionsSnapshot indexOptions)
{
_hostingEnvironment = hostingEnvironment;
+ _indexOptions = indexOptions.Get(index.Name);
Index = index;
Logger = logger;
}
@@ -43,7 +51,7 @@ namespace Umbraco.Cms.Infrastructure.Examine
{
get
{
- var luceneDir = Index.GetLuceneDirectory();
+ Directory luceneDir = Index.GetLuceneDirectory();
var d = new Dictionary
{
[nameof(UmbracoExamineIndex.CommitCount)] = Index.CommitCount,
@@ -58,6 +66,20 @@ namespace Umbraco.Cms.Infrastructure.Examine
d[nameof(UmbracoExamineIndex.LuceneIndexFolder)] = fsDir.Directory.ToString().ToLowerInvariant().TrimStart(rootDir.ToLowerInvariant()).Replace("\\", "/").EnsureStartsWith('/');
}
+ if (_indexOptions != null)
+ {
+ if (_indexOptions.DirectoryFactory != null)
+ {
+ d[nameof(LuceneDirectoryIndexOptions.DirectoryFactory)] = _indexOptions.DirectoryFactory.GetType();
+ }
+
+ if (_indexOptions.IndexDeletionPolicy != null)
+ {
+ d[nameof(LuceneDirectoryIndexOptions.IndexDeletionPolicy)] = _indexOptions.IndexDeletionPolicy.GetType();
+ }
+
+ }
+
return d;
}
}
diff --git a/src/Umbraco.Examine.Lucene/LuceneIndexDiagnosticsFactory.cs b/src/Umbraco.Examine.Lucene/LuceneIndexDiagnosticsFactory.cs
index bdfc299121..fb8b082d15 100644
--- a/src/Umbraco.Examine.Lucene/LuceneIndexDiagnosticsFactory.cs
+++ b/src/Umbraco.Examine.Lucene/LuceneIndexDiagnosticsFactory.cs
@@ -1,9 +1,13 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
+using System;
using Examine;
+using Examine.Lucene;
using Examine.Lucene.Providers;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Hosting;
namespace Umbraco.Cms.Infrastructure.Examine
@@ -17,7 +21,9 @@ namespace Umbraco.Cms.Infrastructure.Examine
private readonly ILoggerFactory _loggerFactory;
private readonly IHostingEnvironment _hostingEnvironment;
- public LuceneIndexDiagnosticsFactory(ILoggerFactory loggerFactory, IHostingEnvironment hostingEnvironment)
+ public LuceneIndexDiagnosticsFactory(
+ ILoggerFactory loggerFactory,
+ IHostingEnvironment hostingEnvironment)
{
_loggerFactory = loggerFactory;
_hostingEnvironment = hostingEnvironment;
@@ -29,7 +35,11 @@ namespace Umbraco.Cms.Infrastructure.Examine
{
if (index is LuceneIndex luceneIndex)
{
- indexDiag = new LuceneIndexDiagnostics(luceneIndex, _loggerFactory.CreateLogger(), _hostingEnvironment);
+ indexDiag = new LuceneIndexDiagnostics(
+ luceneIndex,
+ _loggerFactory.CreateLogger(),
+ _hostingEnvironment,
+ null);
}
else
{
diff --git a/src/Umbraco.Examine.Lucene/LuceneRAMDirectoryFactory.cs b/src/Umbraco.Examine.Lucene/LuceneRAMDirectoryFactory.cs
index 2b25350f09..1c7127b9d5 100644
--- a/src/Umbraco.Examine.Lucene/LuceneRAMDirectoryFactory.cs
+++ b/src/Umbraco.Examine.Lucene/LuceneRAMDirectoryFactory.cs
@@ -3,19 +3,23 @@
using System;
using System.IO;
+using System.Threading;
using Examine.Lucene.Directories;
+using Examine.Lucene.Providers;
using Lucene.Net.Store;
using Directory = Lucene.Net.Store.Directory;
namespace Umbraco.Cms.Infrastructure.Examine
{
- public class LuceneRAMDirectoryFactory : IDirectoryFactory
+ public class LuceneRAMDirectoryFactory : DirectoryFactoryBase
{
+
public LuceneRAMDirectoryFactory()
{
}
- public Directory CreateDirectory(string indexName) => new RandomIdRAMDirectory();
+ protected override Directory CreateDirectory(LuceneIndex luceneIndex, bool forceUnlock)
+ => new RandomIdRAMDirectory();
private class RandomIdRAMDirectory : RAMDirectory
{
diff --git a/src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj b/src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj
index 86cb2fff20..fdd8ba9d64 100644
--- a/src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj
+++ b/src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj
@@ -1,4 +1,4 @@
-
+
netstandard2.0
Umbraco.Cms.Infrastructure.Examine
@@ -21,7 +21,11 @@
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Umbraco.Examine.Lucene/UmbracoExamineIndex.cs b/src/Umbraco.Examine.Lucene/UmbracoExamineIndex.cs
index 5ebcb4877a..c8dfdd756a 100644
--- a/src/Umbraco.Examine.Lucene/UmbracoExamineIndex.cs
+++ b/src/Umbraco.Examine.Lucene/UmbracoExamineIndex.cs
@@ -38,7 +38,7 @@ namespace Umbraco.Cms.Infrastructure.Examine
: base(loggerFactory, name, indexOptions)
{
_runtimeState = runtimeState;
- _diagnostics = new UmbracoExamineIndexDiagnostics(this, loggerFactory.CreateLogger(), hostingEnvironment);
+ _diagnostics = new UmbracoExamineIndexDiagnostics(this, loggerFactory.CreateLogger(), hostingEnvironment, indexOptions);
_logger = loggerFactory.CreateLogger();
}
diff --git a/src/Umbraco.Examine.Lucene/UmbracoExamineIndexDiagnostics.cs b/src/Umbraco.Examine.Lucene/UmbracoExamineIndexDiagnostics.cs
index b8e6a20e68..08b9cd27d3 100644
--- a/src/Umbraco.Examine.Lucene/UmbracoExamineIndexDiagnostics.cs
+++ b/src/Umbraco.Examine.Lucene/UmbracoExamineIndexDiagnostics.cs
@@ -1,9 +1,11 @@
-// Copyright (c) Umbraco.
+// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.Collections.Generic;
using System.Linq;
+using Examine.Lucene;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Hosting;
namespace Umbraco.Cms.Infrastructure.Examine
@@ -12,8 +14,12 @@ namespace Umbraco.Cms.Infrastructure.Examine
{
private readonly UmbracoExamineIndex _index;
- public UmbracoExamineIndexDiagnostics(UmbracoExamineIndex index, ILogger logger, IHostingEnvironment hostingEnvironment)
- : base(index, logger, hostingEnvironment)
+ public UmbracoExamineIndexDiagnostics(
+ UmbracoExamineIndex index,
+ ILogger logger,
+ IHostingEnvironment hostingEnvironment,
+ IOptionsSnapshot indexOptions)
+ : base(index, logger, hostingEnvironment, indexOptions)
{
_index = index;
}
diff --git a/src/Umbraco.Infrastructure/Examine/ExamineIndexRebuilder.cs b/src/Umbraco.Infrastructure/Examine/ExamineIndexRebuilder.cs
index d7719cfd40..7d0a933027 100644
--- a/src/Umbraco.Infrastructure/Examine/ExamineIndexRebuilder.cs
+++ b/src/Umbraco.Infrastructure/Examine/ExamineIndexRebuilder.cs
@@ -93,10 +93,18 @@ namespace Umbraco.Cms.Infrastructure.Examine
if (useBackgroundThread)
{
- _logger.LogInformation($"Starting async background thread for {nameof(RebuildIndexes)}.");
+ _logger.LogDebug($"Queuing background job for {nameof(RebuildIndexes)}.");
_backgroundTaskQueue.QueueBackgroundWorkItem(
- cancellationToken => Task.Run(() => RebuildIndexes(onlyEmptyIndexes, delay.Value, cancellationToken)));
+ cancellationToken =>
+ {
+ // This is a fire/forget task spawned by the background thread queue (which means we
+ // don't need to worry about ExecutionContext flowing).
+ Task.Run(() => RebuildIndexes(onlyEmptyIndexes, delay.Value, cancellationToken));
+
+ // immediately return so the queue isn't waiting.
+ return Task.CompletedTask;
+ });
}
else
{
@@ -162,8 +170,9 @@ namespace Umbraco.Cms.Infrastructure.Examine
}
else
{
+ // If an index exists but it has zero docs we'll consider it empty and rebuild
IIndex[] indexes = (onlyEmptyIndexes
- ? _examineManager.Indexes.Where(x => !x.IndexExists())
+ ? _examineManager.Indexes.Where(x => !x.IndexExists() || (x is IIndexStats stats && stats.GetDocumentCount() == 0))
: _examineManager.Indexes).ToArray();
if (indexes.Length == 0)
diff --git a/src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs b/src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs
index 6c6d209e5a..d19db3b285 100644
--- a/src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs
+++ b/src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs
@@ -242,34 +242,35 @@ namespace Umbraco.Cms.Infrastructure.Examine
private class DeferedReIndexForContent : DeferedAction
{
private readonly IBackgroundTaskQueue _backgroundTaskQueue;
- private readonly ExamineUmbracoIndexingHandler _ExamineUmbracoIndexingHandler;
+ private readonly ExamineUmbracoIndexingHandler _examineUmbracoIndexingHandler;
private readonly IContent _content;
private readonly bool _isPublished;
- public DeferedReIndexForContent(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler ExamineUmbracoIndexingHandler, IContent content, bool isPublished)
+ public DeferedReIndexForContent(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler examineUmbracoIndexingHandler, IContent content, bool isPublished)
{
_backgroundTaskQueue = backgroundTaskQueue;
- _ExamineUmbracoIndexingHandler = ExamineUmbracoIndexingHandler;
+ _examineUmbracoIndexingHandler = examineUmbracoIndexingHandler;
_content = content;
_isPublished = isPublished;
}
- public override void Execute() => Execute(_backgroundTaskQueue, _ExamineUmbracoIndexingHandler, _content, _isPublished);
+ public override void Execute() => Execute(_backgroundTaskQueue, _examineUmbracoIndexingHandler, _content, _isPublished);
- public static void Execute(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler ExamineUmbracoIndexingHandler, IContent content, bool isPublished)
+ public static void Execute(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler examineUmbracoIndexingHandler, IContent content, bool isPublished)
=> backgroundTaskQueue.QueueBackgroundWorkItem(cancellationToken =>
{
- using IScope scope = ExamineUmbracoIndexingHandler._scopeProvider.CreateScope(autoComplete: true);
+ using IScope scope = examineUmbracoIndexingHandler._scopeProvider.CreateScope(autoComplete: true);
// for content we have a different builder for published vs unpublished
// we don't want to build more value sets than is needed so we'll lazily build 2 one for published one for non-published
var builders = new Dictionary>>
{
- [true] = new Lazy>(() => ExamineUmbracoIndexingHandler._publishedContentValueSetBuilder.GetValueSets(content).ToList()),
- [false] = new Lazy>(() => ExamineUmbracoIndexingHandler._contentValueSetBuilder.GetValueSets(content).ToList())
+ [true] = new Lazy>(() => examineUmbracoIndexingHandler._publishedContentValueSetBuilder.GetValueSets(content).ToList()),
+ [false] = new Lazy>(() => examineUmbracoIndexingHandler._contentValueSetBuilder.GetValueSets(content).ToList())
};
- foreach (IUmbracoIndex index in ExamineUmbracoIndexingHandler._examineManager.Indexes.OfType()
+ // This is only for content - so only index items for IUmbracoContentIndex (to exlude members)
+ foreach (IUmbracoIndex index in examineUmbracoIndexingHandler._examineManager.Indexes.OfType()
//filter the indexers
.Where(x => isPublished || !x.PublishedValuesOnly)
.Where(x => x.EnableDefaultEventHandler))
@@ -293,29 +294,30 @@ namespace Umbraco.Cms.Infrastructure.Examine
private class DeferedReIndexForMedia : DeferedAction
{
private readonly IBackgroundTaskQueue _backgroundTaskQueue;
- private readonly ExamineUmbracoIndexingHandler _ExamineUmbracoIndexingHandler;
+ private readonly ExamineUmbracoIndexingHandler _examineUmbracoIndexingHandler;
private readonly IMedia _media;
private readonly bool _isPublished;
- public DeferedReIndexForMedia(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler ExamineUmbracoIndexingHandler, IMedia media, bool isPublished)
+ public DeferedReIndexForMedia(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler examineUmbracoIndexingHandler, IMedia media, bool isPublished)
{
_backgroundTaskQueue = backgroundTaskQueue;
- _ExamineUmbracoIndexingHandler = ExamineUmbracoIndexingHandler;
+ _examineUmbracoIndexingHandler = examineUmbracoIndexingHandler;
_media = media;
_isPublished = isPublished;
}
- public override void Execute() => Execute(_backgroundTaskQueue, _ExamineUmbracoIndexingHandler, _media, _isPublished);
+ public override void Execute() => Execute(_backgroundTaskQueue, _examineUmbracoIndexingHandler, _media, _isPublished);
- public static void Execute(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler ExamineUmbracoIndexingHandler, IMedia media, bool isPublished) =>
+ public static void Execute(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler examineUmbracoIndexingHandler, IMedia media, bool isPublished) =>
// perform the ValueSet lookup on a background thread
backgroundTaskQueue.QueueBackgroundWorkItem(cancellationToken =>
{
- using IScope scope = ExamineUmbracoIndexingHandler._scopeProvider.CreateScope(autoComplete: true);
+ using IScope scope = examineUmbracoIndexingHandler._scopeProvider.CreateScope(autoComplete: true);
- var valueSet = ExamineUmbracoIndexingHandler._mediaValueSetBuilder.GetValueSets(media).ToList();
+ var valueSet = examineUmbracoIndexingHandler._mediaValueSetBuilder.GetValueSets(media).ToList();
- foreach (IUmbracoIndex index in ExamineUmbracoIndexingHandler._examineManager.Indexes.OfType()
+ // This is only for content - so only index items for IUmbracoContentIndex (to exlude members)
+ foreach (IUmbracoIndex index in examineUmbracoIndexingHandler._examineManager.Indexes.OfType()
//filter the indexers
.Where(x => isPublished || !x.PublishedValuesOnly)
.Where(x => x.EnableDefaultEventHandler))
@@ -332,27 +334,29 @@ namespace Umbraco.Cms.Infrastructure.Examine
///
private class DeferedReIndexForMember : DeferedAction
{
- private readonly ExamineUmbracoIndexingHandler _ExamineUmbracoIndexingHandler;
+ private readonly ExamineUmbracoIndexingHandler _examineUmbracoIndexingHandler;
private readonly IMember _member;
private readonly IBackgroundTaskQueue _backgroundTaskQueue;
- public DeferedReIndexForMember(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler ExamineUmbracoIndexingHandler, IMember member)
+ public DeferedReIndexForMember(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler examineUmbracoIndexingHandler, IMember member)
{
- _ExamineUmbracoIndexingHandler = ExamineUmbracoIndexingHandler;
+ _examineUmbracoIndexingHandler = examineUmbracoIndexingHandler;
_member = member;
_backgroundTaskQueue = backgroundTaskQueue;
}
- public override void Execute() => Execute(_backgroundTaskQueue, _ExamineUmbracoIndexingHandler, _member);
+ public override void Execute() => Execute(_backgroundTaskQueue, _examineUmbracoIndexingHandler, _member);
- public static void Execute(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler ExamineUmbracoIndexingHandler, IMember member) =>
+ public static void Execute(IBackgroundTaskQueue backgroundTaskQueue, ExamineUmbracoIndexingHandler examineUmbracoIndexingHandler, IMember member) =>
// perform the ValueSet lookup on a background thread
backgroundTaskQueue.QueueBackgroundWorkItem(cancellationToken =>
{
- using IScope scope = ExamineUmbracoIndexingHandler._scopeProvider.CreateScope(autoComplete: true);
+ using IScope scope = examineUmbracoIndexingHandler._scopeProvider.CreateScope(autoComplete: true);
- var valueSet = ExamineUmbracoIndexingHandler._memberValueSetBuilder.GetValueSets(member).ToList();
- foreach (IUmbracoIndex index in ExamineUmbracoIndexingHandler._examineManager.Indexes.OfType()
+ var valueSet = examineUmbracoIndexingHandler._memberValueSetBuilder.GetValueSets(member).ToList();
+
+ // only process for IUmbracoMemberIndex (not content indexes)
+ foreach (IUmbracoIndex index in examineUmbracoIndexingHandler._examineManager.Indexes.OfType()
//filter the indexers
.Where(x => x.EnableDefaultEventHandler))
{
@@ -365,23 +369,23 @@ namespace Umbraco.Cms.Infrastructure.Examine
private class DeferedDeleteIndex : DeferedAction
{
- private readonly ExamineUmbracoIndexingHandler _ExamineUmbracoIndexingHandler;
+ private readonly ExamineUmbracoIndexingHandler _examineUmbracoIndexingHandler;
private readonly int _id;
private readonly bool _keepIfUnpublished;
- public DeferedDeleteIndex(ExamineUmbracoIndexingHandler ExamineUmbracoIndexingHandler, int id, bool keepIfUnpublished)
+ public DeferedDeleteIndex(ExamineUmbracoIndexingHandler examineUmbracoIndexingHandler, int id, bool keepIfUnpublished)
{
- _ExamineUmbracoIndexingHandler = ExamineUmbracoIndexingHandler;
+ _examineUmbracoIndexingHandler = examineUmbracoIndexingHandler;
_id = id;
_keepIfUnpublished = keepIfUnpublished;
}
- public override void Execute() => Execute(_ExamineUmbracoIndexingHandler, _id, _keepIfUnpublished);
+ public override void Execute() => Execute(_examineUmbracoIndexingHandler, _id, _keepIfUnpublished);
- public static void Execute(ExamineUmbracoIndexingHandler ExamineUmbracoIndexingHandler, int id, bool keepIfUnpublished)
+ public static void Execute(ExamineUmbracoIndexingHandler examineUmbracoIndexingHandler, int id, bool keepIfUnpublished)
{
var strId = id.ToString(CultureInfo.InvariantCulture);
- foreach (var index in ExamineUmbracoIndexingHandler._examineManager.Indexes.OfType()
+ foreach (var index in examineUmbracoIndexingHandler._examineManager.Indexes.OfType()
.Where(x => x.PublishedValuesOnly || !keepIfUnpublished)
.Where(x => x.EnableDefaultEventHandler))
{
diff --git a/src/Umbraco.Infrastructure/Examine/IUmbracoContentIndex.cs b/src/Umbraco.Infrastructure/Examine/IUmbracoContentIndex.cs
index 63bbfb047a..0735cc255d 100644
--- a/src/Umbraco.Infrastructure/Examine/IUmbracoContentIndex.cs
+++ b/src/Umbraco.Infrastructure/Examine/IUmbracoContentIndex.cs
@@ -5,8 +5,7 @@ namespace Umbraco.Cms.Infrastructure.Examine
///
/// Marker interface for indexes of Umbraco content
///
- public interface IUmbracoContentIndex : IIndex
+ public interface IUmbracoContentIndex : IUmbracoIndex
{
- bool PublishedValuesOnly { get; }
}
}
diff --git a/src/Umbraco.Infrastructure/Examine/IUmbracoMemberIndex.cs b/src/Umbraco.Infrastructure/Examine/IUmbracoMemberIndex.cs
index d09c8518fa..7dc07688a9 100644
--- a/src/Umbraco.Infrastructure/Examine/IUmbracoMemberIndex.cs
+++ b/src/Umbraco.Infrastructure/Examine/IUmbracoMemberIndex.cs
@@ -2,7 +2,7 @@ using Examine;
namespace Umbraco.Cms.Infrastructure.Examine
{
- public interface IUmbracoMemberIndex : IIndex
+ public interface IUmbracoMemberIndex : IUmbracoIndex
{
}
diff --git a/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj b/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj
index 898891ec71..6198cb91c2 100644
--- a/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj
+++ b/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj
@@ -1,4 +1,4 @@
-
+
Exe
@@ -66,7 +66,7 @@
-
+