diff --git a/Composite/Search/DocumentSources/CmsPageDocumentSource.cs b/Composite/Search/DocumentSources/CmsPageDocumentSource.cs index e38a3ca404..edc8df72d1 100644 --- a/Composite/Search/DocumentSources/CmsPageDocumentSource.cs +++ b/Composite/Search/DocumentSources/CmsPageDocumentSource.cs @@ -16,14 +16,18 @@ namespace Composite.Search.DocumentSources { - internal class CmsPageDocumentSource : ISearchDocumentSource + public class CmsPageDocumentSource : ISearchDocumentSource { const string LogTitle = nameof(CmsPageDocumentSource); - private readonly List _listeners = new List(); + protected List _listeners = new List(); private readonly DataChangesIndexNotifier _changesIndexNotifier; - private readonly Lazy> _customFields; - private readonly IEnumerable _docBuilderExtensions; + protected Lazy> _customFields; + protected IEnumerable _docBuilderExtensions; + + protected CmsPageDocumentSource() + { + } public CmsPageDocumentSource(IEnumerable extensions) { @@ -55,14 +59,14 @@ public CmsPageDocumentSource(IEnumerable extens _changesIndexNotifier.Start(); } - public string Name => typeof (IPage).FullName; + public virtual string Name => typeof (IPage).FullName; - public void Subscribe(IDocumentSourceListener sourceListener) + public virtual void Subscribe(IDocumentSourceListener sourceListener) { _listeners.Add(sourceListener); } - public IEnumerable GetSearchDocuments(CultureInfo culture, string continuationToken = null) + public virtual IEnumerable GetSearchDocuments(CultureInfo culture, string continuationToken = null) { ICollection unpublishedPages; IDictionary parentPageIDs; @@ -145,7 +149,7 @@ public IEnumerable GetSearchDocuments(CultureInfo public IReadOnlyCollection CustomFields => _customFields.Value; - private SearchDocument FromPage(IPage page, EntityToken entityToken, Dictionary, List> allMetaData) + protected virtual SearchDocument FromPage(IPage page, EntityToken entityToken, Dictionary, List> allMetaData) { string label = page.MenuTitle; if (string.IsNullOrWhiteSpace(label)) @@ -216,7 +220,7 @@ private EntityToken GetAdministratedEntityToken(IPage page) } } - private string GetDocumentId(IPage page) + protected virtual string GetDocumentId(IPage page) { bool isUnpublished = page.DataSourceId.PublicationScope == PublicationScope.Unpublished; @@ -329,7 +333,7 @@ private bool AllAncestorPagesArePublished(Guid pageId, CultureInfo locale) return false; } - private bool PageShouldBeIndexed(IData data) + protected bool PageShouldBeIndexed(IData data) { if (!(data is IPage page)) {