Example #1
0
        /// <summary>
        /// Method for reindexing data in all documents of Umbraco, this is a performaceheavy invocation and should be
        /// used with care!
        /// </summary>
        public static void ReIndex()
        {
            // Create new index
            IndexWriter w = ContentIndex(true);

            w.Close();

            Guid[] documents = Cms.BusinessLogic.web.Document.getAllUniquesFromObjectType(Cms.BusinessLogic.web.Document._objectType);

            System.Web.HttpContext.Current.Application["umbIndexerTotal"] = documents.Length;
            System.Web.HttpContext.Current.Application["umbIndexerCount"] = 0;
            System.Web.HttpContext.Current.Application["umbIndexerInfo"]  = "";

            foreach (Guid g in documents)
            {
                Cms.BusinessLogic.web.Document d =
                    new Cms.BusinessLogic.web.Document(g);
                d.Index(true);
                System.Web.HttpContext.Current.Application.Lock();
                System.Web.HttpContext.Current.Application["umbIndexerInfo"]  = d.Text;
                System.Web.HttpContext.Current.Application["umbIndexerCount"] =
                    ((int)System.Web.HttpContext.Current.Application["umbIndexerCount"]) + 1;
                System.Web.HttpContext.Current.Application.UnLock();
            }
        }
Example #2
0
		/// <summary>
		/// Method for reindexing data in all documents of Umbraco, this is a performaceheavy invocation and should be
		/// used with care!
		/// </summary>
		public static void ReIndex() 
		{
			// Create new index
			IndexWriter w = ContentIndex(true);
			w.Close();

			Guid[] documents = Cms.BusinessLogic.web.Document.getAllUniquesFromObjectType(Cms.BusinessLogic.web.Document._objectType);
			
			System.Web.HttpContext.Current.Application["umbIndexerTotal"] = documents.Length;
			System.Web.HttpContext.Current.Application["umbIndexerCount"] = 0;
			System.Web.HttpContext.Current.Application["umbIndexerInfo"] = "";

			foreach(Guid g in documents) 
			{
				Cms.BusinessLogic.web.Document d = 
				new Cms.BusinessLogic.web.Document(g);
				d.Index(true);
				System.Web.HttpContext.Current.Application.Lock();
				System.Web.HttpContext.Current.Application["umbIndexerInfo"] = d.Text;
				System.Web.HttpContext.Current.Application["umbIndexerCount"] = 
					((int) System.Web.HttpContext.Current.Application["umbIndexerCount"])+1;
				System.Web.HttpContext.Current.Application.UnLock();
			}
		}