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;
		}
Beispiel #2
0
		public override void TestSetup()
		{
            base.TestSetup();
			_luceneDir = new RAMDirectory();
			_indexer = IndexInitializer.GetUmbracoIndexer(_luceneDir);
			_indexer.RebuildIndex();
			_searcher = IndexInitializer.GetUmbracoSearcher(_luceneDir);
		}
Beispiel #3
0
        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;
        }
		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;
		}
Beispiel #5
0
        public static UmbracoContentIndexer GetUmbracoIndexer(IndexWriter writer)
        {
            var i = new UmbracoContentIndexer(CreateCriteria(),
                writer, //global writer
                new TestDataService(),                
                false);

            i.IndexingError += IndexingError;

            return i;
        }
Beispiel #6
0
        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;
        }