Exemple #1
0
        public static UmbracoContentIndexer GetUmbracoIndexer(
            Lucene.Net.Store.Directory luceneDir,
            Analyzer analyzer        = null,
            IDataService dataService = null)
        {
            if (dataService == null)
            {
                dataService = new TestDataService();
            }

            if (analyzer == null)
            {
                analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29);
            }

            var indexSet      = new IndexSet();
            var indexCriteria = indexSet.ToIndexCriteria(dataService, UmbracoContentIndexer.IndexFieldPolicies);

            var i = new UmbracoContentIndexer(indexCriteria,
                                              luceneDir,         //custom lucene directory
                                              dataService,
                                              analyzer,
                                              false);

            //i.IndexSecondsInterval = 1;

            i.IndexingError += IndexingError;

            return(i);
        }
Exemple #2
0
 public override void TestSetup()
 {
     _luceneDir = new RAMDirectory();
     _indexer   = IndexInitializer.GetUmbracoIndexer(_luceneDir);
     _indexer.RebuildIndex();
     _searcher = IndexInitializer.GetUmbracoSearcher(_luceneDir);
 }
        public static UmbracoContentIndexer GetUmbracoIndexer(IndexWriter writer)
        {
            var i = new UmbracoContentIndexer(CreateCriteria(),
                                              writer, //global writer
                                              new TestDataService(),
                                              false);

            i.IndexingError += IndexingError;

            return(i);
        }
        public static UmbracoContentIndexer GetUmbracoIndexer(Lucene.Net.Store.Directory luceneDir)
        {
            var i = new UmbracoContentIndexer(CreateCriteria(),
                                              luceneDir, //custom lucene directory
                                              new TestDataService(),
                                              new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29),
                                              false);

            i.IndexingError += IndexingError;

            return(i);
        }
Exemple #5
0
        private void InitUmbracoNodeSearcherEvents()
        {
            UmbracoNodeSearcher searcher = new UmbracoNodeSearcher();

            if (searcher != null)
            {
                UmbracoContentIndexer indexer = (UmbracoContentIndexer)searcher.Indexer;
                if (indexer != null)
                {
                    UmbracoHelper uh = new UmbracoHelper(UmbracoContext.Current);

                    indexer.GatheringNodeData += (sender, e) => UmbracoNodeIndexer_GatheringNodeData(sender, e, uh);
                }
            }
        }
Exemple #6
0
        public void Get_Serialized_Content_With_Published_Content()
        {
            var contentSet = new List <IContent>
            {
                Mock.Of <IContent>(c => c.Id == 1 && c.Path == "-1,1" && c.Published && c.Level == 1),
                Mock.Of <IContent>(c => c.Id == 2 && c.Path == "-1,2" && c.Published && c.Level == 1),
                Mock.Of <IContent>(c => c.Id == 3 && c.Path == "-1,3" && c.Published == false && c.Level == 1),
                Mock.Of <IContent>(c => c.Id == 4 && c.Path == "-1,4" && c.Published == false && c.Level == 1),

                Mock.Of <IContent>(c => c.Id == 5 && c.Path == "-1,1,5" && c.Published && c.Level == 2),
                Mock.Of <IContent>(c => c.Id == 6 && c.Path == "-1,2,6" && c.Published == false && c.Level == 2),
                Mock.Of <IContent>(c => c.Id == 7 && c.Path == "-1,3,7" && c.Published && c.Level == 2),
                Mock.Of <IContent>(c => c.Id == 8 && c.Path == "-1,4,8" && c.Published && c.Level == 2),
                Mock.Of <IContent>(c => c.Id == 9 && c.Path == "-1,4,9" && c.Published && c.Level == 2),

                Mock.Of <IContent>(c => c.Id == 10 && c.Path == "-1,1,5,10" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 15 && c.Path == "-1,1,5,15" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 11 && c.Path == "-1,2,6,11" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 16 && c.Path == "-1,2,6,16" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 12 && c.Path == "-1,3,7,12" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 17 && c.Path == "-1,3,7,17" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 13 && c.Path == "-1,4,8,13" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 18 && c.Path == "-1,4,8,18" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 14 && c.Path == "-1,4,9,14" && c.Published && c.Level == 3),
                Mock.Of <IContent>(c => c.Id == 19 && c.Path == "-1,4,9,19" && c.Published && c.Level == 3),
            };

            //ensure the rest of the required values are populted
            foreach (var content in contentSet)
            {
                var mock = Mock.Get(content);
                mock.Setup(x => x.ContentType).Returns(Mock.Of <IContentType>(type => type.Icon == "hello"));
            }

            contentSet.Sort((a, b) => Comparer <int> .Default.Compare(a.Level, b.Level));

            var published = new HashSet <string>();

            var result = UmbracoContentIndexer.GetSerializedContent(true, content => new XElement("test"), contentSet, published)
                         .WhereNotNull()
                         .ToArray();

            Assert.AreEqual(19, result.Length);
        }
Exemple #7
0
        /// <summary>
        /// Boot-up is completed, this allows you to perform any other boot-up logic required for the application.
        /// Resolution is frozen so now they can be used to resolve instances.
        /// </summary>
        /// <param name="umbracoApplication">
        /// The current <see cref="UmbracoApplicationBase"/>
        /// </param>
        /// <param name="applicationContext">
        /// The Umbraco <see cref="ApplicationContext"/> for the current application.
        /// </param>
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            // Try and install the package.
            if (!ZoombracoBootstrapper.Install(umbracoApplication, applicationContext))
            {
                return;
            }

            // Register custom routes.
            RouteBuilder.RegisterRoutes(RouteTable.Routes);

            // Ensure that the xml formatter does not interfere with API controllers.
            GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();

            // Clear out any CDN url requests on new image processing.
            // This ensures that when we update an image the cached CDN result for rendering is deleted.
            ImageProcessingModule.OnPostProcessing += (s, e) => { ZoombracoApplicationCache.RemoveItem(e.Context.Request.Unvalidated.RawUrl); };

            // Assign indexer for full text searching.
            UmbracoContentIndexer  indexProvider  = ExamineManager.Instance.IndexProviderCollection[ZoombracoConstants.Search.IndexerName] as UmbracoContentIndexer;
            UmbracoExamineSearcher searchProvider = ExamineManager.Instance.SearchProviderCollection[ZoombracoConstants.Search.SearcherName] as UmbracoExamineSearcher;

            if (indexProvider == null)
            {
                throw new ArgumentOutOfRangeException($"{ZoombracoConstants.Search.IndexerName} is missing. Please check the ExamineSettings.config file.");
            }

            if (searchProvider == null)
            {
                throw new ArgumentOutOfRangeException($"{ZoombracoConstants.Search.SearcherName} is missing. Please check the ExamineSettings.config file.");
            }

            UmbracoHelper helper        = new UmbracoHelper(UmbracoContext.Current);
            ContentHelper contentHelper = new ContentHelper(helper);

            indexProvider.GatheringNodeData += (sender, e) => this.GatheringNodeData(sender, e, helper, contentHelper, applicationContext);

            // Register the VortoPropertyAttribute as the default property processor so that any property can be made multilingual.
            Ditto.RegisterDefaultProcessorType <VortoPropertyAttribute>();
        }
Exemple #8
0
        private void optimizeIndexes(ResultResponse res)
        {
            try
            {
                foreach (var orderItemsIndexer in ExamineManager.Instance.IndexProviderCollection)
                {
                    UmbracoContentIndexer umbracoOrderItemsIndexer = null;

                    if (orderItemsIndexer is UmbracoContentIndexer)
                    {
                        umbracoOrderItemsIndexer = (UmbracoContentIndexer)orderItemsIndexer;
                        umbracoOrderItemsIndexer.OptimizeIndex();
                    }

                    res.Success &= true;
                }
            }
            catch (Exception e)
            {
                LogHelper.Error <SystemSurfaceController>("Failed to optimize indexes.", e);
                res.Success  = false;
                res.Message += "Failed to optimize indexes. ";
            }
        }
        public static UmbracoContentIndexer GetUmbracoIndexer(
            Directory luceneDir,
            Analyzer analyzer                = null,
            IDataService dataService         = null,
            IContentService contentService   = null,
            IMediaService mediaService       = null,
            IDataTypeService dataTypeService = null,
            IMemberService memberService     = null,
            IUserService userService         = null)
        {
            if (dataService == null)
            {
                dataService = new TestDataService();
            }
            if (contentService == null)
            {
                contentService = Mock.Of <IContentService>();
            }
            if (userService == null)
            {
                userService = Mock.Of <IUserService>(x => x.GetProfileById(It.IsAny <int>()) == Mock.Of <IProfile>(p => p.Id == (object)0 && p.Name == "admin"));
            }
            if (mediaService == null)
            {
                long totalRecs;

                var allRecs = dataService.MediaService.GetLatestMediaByXpath("//node")
                              .Root
                              .Elements()
                              .Select(x => Mock.Of <IMedia>(
                                          m =>
                                          m.Id == (int)x.Attribute("id") &&
                                          m.ParentId == (int)x.Attribute("parentID") &&
                                          m.Level == (int)x.Attribute("level") &&
                                          m.CreatorId == 0 &&
                                          m.SortOrder == (int)x.Attribute("sortOrder") &&
                                          m.CreateDate == (DateTime)x.Attribute("createDate") &&
                                          m.UpdateDate == (DateTime)x.Attribute("updateDate") &&
                                          m.Name == (string)x.Attribute("nodeName") &&
                                          m.Path == (string)x.Attribute("path") &&
                                          m.Properties == new PropertyCollection() &&
                                          m.ContentType == Mock.Of <IMediaType>(mt =>
                                                                                mt.Alias == (string)x.Attribute("nodeTypeAlias") &&
                                                                                mt.Id == (int)x.Attribute("nodeType"))))
                              .ToArray();


                mediaService = Mock.Of <IMediaService>(
                    x => x.GetPagedDescendants(
                        It.IsAny <int>(), It.IsAny <long>(), It.IsAny <int>(), out totalRecs, It.IsAny <string>(), It.IsAny <Direction>(), It.IsAny <string>())
                    ==
                    allRecs);
            }
            if (dataTypeService == null)
            {
                dataTypeService = Mock.Of <IDataTypeService>();
            }

            if (memberService == null)
            {
                memberService = Mock.Of <IMemberService>();
            }

            if (analyzer == null)
            {
                analyzer = new StandardAnalyzer(Version.LUCENE_29);
            }

            var indexSet      = new IndexSet();
            var indexCriteria = indexSet.ToIndexCriteria(dataService, UmbracoContentIndexer.IndexFieldPolicies);

            var i = new UmbracoContentIndexer(indexCriteria,
                                              luceneDir,         //custom lucene directory
                                              dataService,
                                              contentService,
                                              mediaService,
                                              dataTypeService,
                                              userService,
                                              analyzer,
                                              false);

            //i.IndexSecondsInterval = 1;

            i.IndexingError += IndexingError;

            return(i);
        }
Exemple #10
0
        public static UmbracoContentIndexer GetUmbracoIndexer(
            IndexWriter writer,
            Analyzer analyzer                      = null,
            IDataService dataService               = null,
            IContentService contentService         = null,
            IMediaService mediaService             = null,
            IDataTypeService dataTypeService       = null,
            IMemberService memberService           = null,
            IUserService userService               = null,
            IContentTypeService contentTypeService = null,
            bool supportUnpublishedContent         = false)
        {
            if (dataService == null)
            {
                dataService = new TestDataService();
            }
            if (contentService == null)
            {
                long longTotalRecs;
                int  intTotalRecs;

                var allRecs = dataService.ContentService.GetLatestContentByXPath("//*[@isDoc]")
                              .Root
                              .Elements()
                              .Select(x => Mock.Of <IContent>(
                                          m =>
                                          m.Id == (int)x.Attribute("id") &&
                                          m.ParentId == (int)x.Attribute("parentID") &&
                                          m.Level == (int)x.Attribute("level") &&
                                          m.CreatorId == 0 &&
                                          m.SortOrder == (int)x.Attribute("sortOrder") &&
                                          m.CreateDate == (DateTime)x.Attribute("createDate") &&
                                          m.UpdateDate == (DateTime)x.Attribute("updateDate") &&
                                          m.Name == (string)x.Attribute("nodeName") &&
                                          m.Path == (string)x.Attribute("path") &&
                                          m.Properties == new PropertyCollection() &&
                                          m.ContentType == Mock.Of <IContentType>(mt =>
                                                                                  mt.Alias == x.Name.LocalName &&
                                                                                  mt.Id == (int)x.Attribute("nodeType") &&
                                                                                  mt.Icon == "test")))
                              .ToArray();


                contentService = Mock.Of <IContentService>(
                    x => x.GetPagedDescendants(
                        It.IsAny <int>(), It.IsAny <long>(), It.IsAny <int>(), out longTotalRecs, It.IsAny <string>(), It.IsAny <Direction>(), It.IsAny <bool>(), It.IsAny <string>())
                    ==
                    allRecs &&
                    x.GetPagedDescendants(
                        It.IsAny <int>(), It.IsAny <long>(), It.IsAny <int>(), out longTotalRecs, It.IsAny <string>(), It.IsAny <Direction>(), It.IsAny <string>())
                    ==
                    allRecs &&
                    x.GetPagedDescendants(
                        It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), out intTotalRecs, It.IsAny <string>(), It.IsAny <Direction>(), It.IsAny <string>())
                    ==
                    allRecs &&
                    x.GetPagedDescendants(
                        It.IsAny <int>(), It.IsAny <long>(), It.IsAny <int>(), out longTotalRecs, It.IsAny <string>(), It.IsAny <Direction>(), It.IsAny <bool>(), It.IsAny <IQuery <IContent> >())
                    ==
                    allRecs);
            }
            if (userService == null)
            {
                userService = Mock.Of <IUserService>(x => x.GetProfileById(It.IsAny <int>()) == Mock.Of <IProfile>(p => p.Id == 0 && p.Name == "admin"));
            }
            if (mediaService == null)
            {
                long longTotalRecs;
                int  intTotalRecs;

                var mediaXml = dataService.MediaService.GetLatestMediaByXpath("//node");
                var allRecs  = mediaXml
                               .Root
                               .Elements()
                               .Select(x => Mock.Of <IMedia>(
                                           m =>
                                           m.Id == (int)x.Attribute("id") &&
                                           m.ParentId == (int)x.Attribute("parentID") &&
                                           m.Level == (int)x.Attribute("level") &&
                                           m.CreatorId == 0 &&
                                           m.SortOrder == (int)x.Attribute("sortOrder") &&
                                           m.CreateDate == (DateTime)x.Attribute("createDate") &&
                                           m.UpdateDate == (DateTime)x.Attribute("updateDate") &&
                                           m.Name == (string)x.Attribute("nodeName") &&
                                           m.Path == (string)x.Attribute("path") &&
                                           m.Properties == new PropertyCollection() &&
                                           m.ContentType == Mock.Of <IMediaType>(mt =>
                                                                                 mt.Alias == (string)x.Attribute("nodeTypeAlias") &&
                                                                                 mt.Id == (int)x.Attribute("nodeType"))))
                               .ToArray();

                // MOCK!
                var mediaServiceMock = new Mock <IMediaService>();

                mediaServiceMock
                .Setup(x => x.GetPagedDescendants(
                           It.IsAny <int>(), It.IsAny <long>(), It.IsAny <int>(), out longTotalRecs, It.IsAny <string>(), It.IsAny <Direction>(), It.IsAny <bool>(), It.IsAny <string>())
                       ).Returns(() => allRecs);

                mediaServiceMock
                .Setup(x => x.GetPagedDescendants(
                           It.IsAny <int>(), It.IsAny <long>(), It.IsAny <int>(), out longTotalRecs, It.IsAny <string>(), It.IsAny <Direction>(), It.IsAny <string>())
                       ).Returns(() => allRecs);

                mediaServiceMock
                .Setup(x => x.GetPagedDescendants(
                           It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), out intTotalRecs, It.IsAny <string>(), It.IsAny <Direction>(), It.IsAny <string>())
                       ).Returns(() => allRecs);

                mediaServiceMock.Setup(service => service.GetPagedXmlEntries(It.IsAny <string>(), It.IsAny <long>(), It.IsAny <int>(), out longTotalRecs))
                .Returns(() => allRecs.Select(x => x.ToXml()));

                mediaService = mediaServiceMock.Object;
            }
            if (dataTypeService == null)
            {
                dataTypeService = Mock.Of <IDataTypeService>();
            }

            if (memberService == null)
            {
                memberService = Mock.Of <IMemberService>();
            }

            if (contentTypeService == null)
            {
                var contentTypeServiceMock = new Mock <IContentTypeService>();
                contentTypeServiceMock.Setup(x => x.GetAllMediaTypes())
                .Returns(new List <IMediaType>()
                {
                    new MediaType(-1)
                    {
                        Alias = "Folder", Name = "Folder", Id = 1031, Icon = "icon-folder"
                    },
                    new MediaType(-1)
                    {
                        Alias = "Image", Name = "Image", Id = 1032, Icon = "icon-picture"
                    }
                });
                contentTypeService = contentTypeServiceMock.Object;
            }

            if (analyzer == null)
            {
                analyzer = new StandardAnalyzer(Version.LUCENE_29);
            }

            var indexSet      = new IndexSet();
            var indexCriteria = indexSet.ToIndexCriteria(dataService, UmbracoContentIndexer.IndexFieldPolicies);

            var i = new UmbracoContentIndexer(indexCriteria,
                                              writer,
                                              dataService,
                                              contentService,
                                              mediaService,
                                              dataTypeService,
                                              userService,
                                              contentTypeService,
                                              false)
            {
                SupportUnpublishedContent = supportUnpublishedContent
            };

            //i.IndexSecondsInterval = 1;

            i.IndexingError += IndexingError;

            return(i);
        }
        public void SaveWithoutEventsAndWithSynchronousReindexing(IContent content, bool doReindex = true, bool doSignal = true)
        {
            try
            {
                var cs = ApplicationContext.Current.Services.ContentService;

                cs.Save(content, 0, false);

                if (doReindex)
                {
                    // Get the order items indexer from Lucene so that we can listen for the IndexOperationComplete event.
                    var orderItemsIndexer = ExamineManager.Instance.IndexProviderCollection["ChalmersILLOrderItemsIndexer"];
                    UmbracoContentIndexer umbracoOrderItemsIndexer = null;

                    // Do some downcasting so that we have access to the IndexOperationComplete event.
                    if (orderItemsIndexer is UmbracoContentIndexer)
                    {
                        umbracoOrderItemsIndexer = (UmbracoContentIndexer)orderItemsIndexer;
                    }

                    Semaphore    semLock = null;
                    EventHandler handler = null;

                    try
                    {
                        if (umbracoOrderItemsIndexer != null)
                        {
                            // Create a semaphore which we use for the synchronization between Lucenes indexing thread and our thread.
                            semLock = new Semaphore(0, 1);

                            // The event handler which will be called when the reindexing is complete.
                            handler = (sender, e) => IndexOperationComplete(sender, e, semLock);

                            // Register the event handler to the IndexOperationComplete event.
                            umbracoOrderItemsIndexer.IndexOperationComplete += handler;
                        }

                        // Start the actual reindexing of the content.
                        ExamineManager.Instance.ReIndexNode(content.ToXml(), "content");

                        if (umbracoOrderItemsIndexer != null)
                        {
                            // Wait for the indexing operations to complete.
                            semLock.WaitOne();

                            // Cleanup
                            semLock.Dispose();
                        }
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    finally
                    {
                        if (umbracoOrderItemsIndexer != null && handler != null)
                        {
                            // Unregister the handler.
                            umbracoOrderItemsIndexer.IndexOperationComplete -= handler;
                        }
                    }
                }

                if (doSignal)
                {
                    // Signal our ChalmersILL clients.
                    _notifier.ReportNewOrderItemUpdate(content);
                }
            }
            catch (Exception e)
            {
                LogHelper.Error <OrderItemManager>("SaveWithoutEventsAndWithSynchronousReindexing: Error when saving content.", e);
                throw new SaveException("Save NodeId=" + content.Id + ", Published=" + content.Published + ", Status=" + content.Status + ", Trashed=" + content.Trashed + ", UpdateDate=" + content.UpdateDate + ".", e);
            }
        }
        public static UmbracoContentIndexer GetUmbracoIndexer(Lucene.Net.Store.Directory luceneDir)
        {
            var i = new UmbracoContentIndexer(new IndexCriteria(
                                                  new[]
            {
                new TestIndexField {
                    Name = "id", EnableSorting = true, Type = "Number"
                },
                new TestIndexField {
                    Name = "nodeName", EnableSorting = true
                },
                new TestIndexField {
                    Name = "updateDate", EnableSorting = true, Type = "DateTime"
                },
                new TestIndexField {
                    Name = "writerName"
                },
                new TestIndexField {
                    Name = "path"
                },
                new TestIndexField {
                    Name = "nodeTypeAlias"
                },
                new TestIndexField {
                    Name = "parentID"
                },
                new TestIndexField {
                    Name = "sortOrder", EnableSorting = true, Type = "Number"
                },
            },
                                                  new[]
            {
                new TestIndexField {
                    Name = "headerText"
                },
                new TestIndexField {
                    Name = "bodyText"
                },
                new TestIndexField {
                    Name = "metaDescription"
                },
                new TestIndexField {
                    Name = "metaKeywords"
                },
                new TestIndexField {
                    Name = "bodyTextColOne"
                },
                new TestIndexField {
                    Name = "bodyTextColTwo"
                },
                new TestIndexField {
                    Name = "xmlStorageTest"
                },
                new TestIndexField {
                    Name = "umbracoNaviHide"
                }
            },
                                                  new[]
            {
                "CWS_Home",
                "CWS_Textpage",
                "CWS_TextpageTwoCol",
                "CWS_NewsEventsList",
                "CWS_NewsItem",
                "CWS_Gallery",
                "CWS_EventItem",
                "Image",
            },
                                                  new string[] { },
                                                  -1),
                                              luceneDir,                                                                    //custom lucene directory
                                              new TestDataService(),
                                              new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29),
                                              false);

            //i.IndexSecondsInterval = 1;

            i.IndexingError += IndexingError;

            return(i);
        }
Exemple #13
0
        public UmbracoContentIndexer GetUmbracoIndexer(DirectoryInfo d)
        {
            var i = new UmbracoContentIndexer(new IndexCriteria(
                                                  new[]
            {
                new TestIndexField {
                    Name = "id", EnableSorting = true, Type = "Number"
                },
                new TestIndexField {
                    Name = "version"
                },
                new TestIndexField {
                    Name = "parentID"
                },
                new TestIndexField {
                    Name = "level"
                },
                new TestIndexField {
                    Name = "writerID"
                },
                new TestIndexField {
                    Name = "creatorID"
                },
                new TestIndexField {
                    Name = "nodeType"
                },
                new TestIndexField {
                    Name = "template"
                },
                new TestIndexField {
                    Name = "sortOrder", EnableSorting = true, Type = "Number"
                },
                new TestIndexField {
                    Name = "createDate", EnableSorting = true, Type = "DateTime"
                },
                new TestIndexField {
                    Name = "updateDate", EnableSorting = true, Type = "DateTime"
                },
                new TestIndexField {
                    Name = "nodeName", EnableSorting = true
                },
                new TestIndexField {
                    Name = "urlName"
                },
                new TestIndexField {
                    Name = "writerName"
                },
                new TestIndexField {
                    Name = "creatorName"
                },
                new TestIndexField {
                    Name = "nodeTypeAlias"
                },
                new TestIndexField {
                    Name = "path"
                }
            },
                                                  new[]
            {
                new TestIndexField {
                    Name = "headerText"
                },
                new TestIndexField {
                    Name = "bodyText"
                },
                new TestIndexField {
                    Name = "metaDescription"
                },
                new TestIndexField {
                    Name = "metaKeywords"
                },
                new TestIndexField {
                    Name = "bodyTextColOne"
                },
                new TestIndexField {
                    Name = "bodyTextColTwo"
                },
                new TestIndexField {
                    Name = "xmlStorageTest"
                }
            },
                                                  Enumerable.Empty <string>(),
                                                  Enumerable.Empty <string>(),
                                                  -1),
                                              d,
                                              new TestDataService(),
                                              new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29),
                                              false);

            //i.IndexSecondsInterval = 1;

            i.IndexingError += IndexingError;

            return(i);
        }