public CmsPageDocumentSource()
        {
            _customFields = new Lazy <ICollection <DocumentField> >(() =>
            {
                var pageDocFields  = DataTypeSearchReflectionHelper.GetDocumentFields(typeof(IPage));
                var metaDataFields = PageMetaDataFacade.GetAllMetaDataTypes()
                                     .SelectMany(dataType => DataTypeSearchReflectionHelper.GetDocumentFields(dataType, false));

                return(pageDocFields
                       .Concat(metaDataFields)
                       .ExcludeDuplicateKeys(f => f.Name)
                       .Evaluate());
            });

            _changesIndexNotifier = new DataChangesIndexNotifier(
                _listeners, typeof(IPage),
                data =>
            {
                var page        = (IPage)data;
                var entityToken = GetAdministratedEntityToken(page);
                return(entityToken != null ? FromPage(page, entityToken) : null);
            },
                data => GetDocumentId((IPage)data));

            _changesIndexNotifier.Start();
        }
Beispiel #2
0
        public CmsPageDocumentSource(IEnumerable <ISearchDocumentBuilderExtension> extensions)
        {
            _customFields = new Lazy <IReadOnlyCollection <DocumentField> >(() =>
            {
                var pageDocFields  = DataTypeSearchReflectionHelper.GetDocumentFields(typeof(IPage));
                var metaDataFields = PageMetaDataFacade.GetAllMetaDataTypes()
                                     .SelectMany(dataType => DataTypeSearchReflectionHelper.GetDocumentFields(dataType, false));

                return(pageDocFields
                       .Concat(metaDataFields)
                       .ExcludeDuplicateKeys(f => f.Name)
                       .ToList());
            });

            _docBuilderExtensions = extensions;

            _changesIndexNotifier = new DataChangesIndexNotifier(
                _listeners, typeof(IPage),
                (data, culture) =>
            {
                var page        = (IPage)data;
                var entityToken = GetAdministratedEntityToken(page);
                return(entityToken != null ? FromPage(page, entityToken, null) : null);
            },
                data => GetDocumentId((IPage)data));

            _changesIndexNotifier.Start();
        }
        public MediaLibraryDocumentSource()
        {
            _customFields = new Lazy <ICollection <DocumentField> >(() =>
                                                                    DataTypeSearchReflectionHelper.GetDocumentFields(typeof(IMediaFile)).Evaluate());

            _changesIndexNotifier = new DataChangesIndexNotifier(
                _listeners, typeof(IMediaFile),
                data => FromMediaFile((IMediaFile)data),
                data => ((IMediaFile)data).Id.ToString());
            _changesIndexNotifier.Start();
        }
Beispiel #4
0
        public MediaLibraryDocumentSource(IEnumerable <ISearchDocumentBuilderExtension> extensions)
        {
            _customFields = new Lazy <IReadOnlyCollection <DocumentField> >(() =>
                                                                            DataTypeSearchReflectionHelper.GetDocumentFields(typeof(IMediaFile)).ToList());

            _docBuilderExtensions = extensions;

            _changesIndexNotifier = new DataChangesIndexNotifier(
                _listeners, typeof(IMediaFile),
                (data, culture) => FromMediaFile((IMediaFile)data),
                data => ((IMediaFile)data).Id.ToString());
            _changesIndexNotifier.Start();
        }
Beispiel #5
0
 List <DocumentField> GetDocumentFields()
 {
     return(DataTypeSearchReflectionHelper.GetDocumentFields(_interfaceType).ToList());
 }
 ICollection <DocumentField> GetDocumentFields()
 {
     return(DataTypeSearchReflectionHelper.GetDocumentFields(_interfaceType).Evaluate());
 }