-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathUmbracoBuilder.Examine.cs
More file actions
89 lines (81 loc) · 5.33 KB
/
UmbracoBuilder.Examine.cs
File metadata and controls
89 lines (81 loc) · 5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using Examine;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.DeliveryApi;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
using Umbraco.Cms.Infrastructure.Examine;
using Umbraco.Cms.Infrastructure.Search;
using Umbraco.Extensions;
namespace Umbraco.Cms.Infrastructure.DependencyInjection;
/// <summary>
/// Provides extension methods to the <see cref="IUmbracoBuilder" /> class.
/// </summary>
public static partial class UmbracoBuilderExtensions
{
public static IUmbracoBuilder AddExamine(this IUmbracoBuilder builder)
{
builder.Services.AddUnique<IExamineManager, ExamineManager>();
// populators are not a collection: one cannot remove ours, and can only add more
// the container can inject IEnumerable<IIndexPopulator> and get them all
builder.Services.AddSingleton<IIndexPopulator, MemberIndexPopulator>();
builder.Services.AddSingleton<IIndexPopulator, ContentIndexPopulator>();
builder.Services.AddSingleton<IIndexPopulator, PublishedContentIndexPopulator>();
builder.Services.AddSingleton<IIndexPopulator, MediaIndexPopulator>();
builder.Services.AddSingleton<IIndexPopulator, DeliveryApiContentIndexPopulator>();
builder.Services.AddSingleton<IIndexRebuilder, ExamineIndexRebuilder>();
builder.Services.AddSingleton<IUmbracoIndexingHandler, ExamineUmbracoIndexingHandler>();
builder.Services.AddSingleton<ExamineIndexingMainDomHandler>();
builder.Services.AddUnique<IUmbracoIndexConfig, UmbracoIndexConfig>();
builder.Services.AddUnique<IIndexDiagnosticsFactory, IndexDiagnosticsFactory>();
builder.Services.AddUnique<IPublishedContentValueSetBuilder>(factory =>
new ContentValueSetBuilder(
factory.GetRequiredService<PropertyEditorCollection>(),
factory.GetRequiredService<UrlSegmentProviderCollection>(),
factory.GetRequiredService<IUserService>(),
factory.GetRequiredService<IShortStringHelper>(),
factory.GetRequiredService<IScopeProvider>(),
true,
factory.GetRequiredService<ILocalizationService>(),
factory.GetRequiredService<IContentTypeService>(),
factory.GetRequiredService<ILogger<ContentValueSetBuilder>>(),
factory.GetRequiredService<IDocumentUrlService>(),
factory.GetRequiredService<ILanguageService>()));
builder.Services.AddUnique<IContentValueSetBuilder>(factory =>
new ContentValueSetBuilder(
factory.GetRequiredService<PropertyEditorCollection>(),
factory.GetRequiredService<UrlSegmentProviderCollection>(),
factory.GetRequiredService<IUserService>(),
factory.GetRequiredService<IShortStringHelper>(),
factory.GetRequiredService<IScopeProvider>(),
false,
factory.GetRequiredService<ILocalizationService>(),
factory.GetRequiredService<IContentTypeService>(),
factory.GetRequiredService<ILogger<ContentValueSetBuilder>>(),
factory.GetRequiredService<IDocumentUrlService>(),
factory.GetRequiredService<ILanguageService>()));
builder.Services.AddUnique<IValueSetBuilder<IMedia>, MediaValueSetBuilder>();
builder.Services.AddUnique<IValueSetBuilder<IMember>, MemberValueSetBuilder>();
builder.Services.AddUnique<IDeliveryApiContentIndexValueSetBuilder, DeliveryApiContentIndexValueSetBuilder>();
builder.Services.AddUnique<IDeliveryApiContentIndexFieldDefinitionBuilder, DeliveryApiContentIndexFieldDefinitionBuilder>();
builder.Services.AddUnique<IDeliveryApiContentIndexHelper, DeliveryApiContentIndexHelper>();
builder.Services.AddSingleton<IDeliveryApiIndexingHandler, DeliveryApiIndexingHandler>();
builder.Services.AddUnique<IDeliveryApiCompositeIdHandler, DeliveryApiCompositeIdHandler>();
builder.AddNotificationHandler<ContentCacheRefresherNotification, ContentIndexingNotificationHandler>();
builder.AddNotificationHandler<PublicAccessCacheRefresherNotification, ContentIndexingNotificationHandler>();
builder.AddNotificationHandler<ContentTypeCacheRefresherNotification, ContentTypeIndexingNotificationHandler>();
builder.AddNotificationHandler<ContentCacheRefresherNotification, DeliveryApiContentIndexingNotificationHandler>();
builder.AddNotificationHandler<ContentTypeCacheRefresherNotification, DeliveryApiContentIndexingNotificationHandler>();
builder.AddNotificationHandler<PublicAccessCacheRefresherNotification, DeliveryApiContentIndexingNotificationHandler>();
builder.AddNotificationHandler<MediaCacheRefresherNotification, MediaIndexingNotificationHandler>();
builder.AddNotificationHandler<MemberCacheRefresherNotification, MemberIndexingNotificationHandler>();
builder.AddNotificationAsyncHandler<LanguageCacheRefresherNotification, LanguageIndexingNotificationHandler>();
builder.AddNotificationHandler<UmbracoRequestBeginNotification, RebuildOnStartupHandler>();
return builder;
}
}