+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Search reindexing

Search reindexing

4 posts, 0 answered
  1. Steve
    Steve avatar
    31 posts
    Registered:
    03 May 2011
    06 Dec 2011
    Link to this post
    How often are searches reindexed? Do I have to manually update the index or will it automatically index new content and remove pages that have been deleted from the site?
  2. Grace Hallwachs
    Grace Hallwachs avatar
    144 posts
    Registered:
    03 Nov 2014
    07 Dec 2011
    Link to this post
    Hi Steve,

    To answer your question, indexes are updated each time you publish (content like News, blogs etc.. and static html is reindexed when publishing pags). Also you are able to reindex the search manually if you wish. If you go to Adminstration >> Search and Indexes, go to the search you wish you reindex, click on Actions and then Reindex.

    Also when your indexes are updated, the previous indexes will be deleted and then recreated again with the newly updated content.

    All the best,
    Grace Hallwachs
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Mani
    Mani avatar
    1 posts
    Registered:
    11 Nov 2014
    08 Dec 2014 in reply to Grace Hallwachs
    Link to this post

    Is there a way to trigger the reindexing through code, we have an issue in our project, wherein the Sitefinity search index is not getting reindexing even after publishing custom modules. Client is not quite comfortable indexing manually

     

  4. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    11 Dec 2014
    Link to this post
    Hello Mani,

    Actually in this case it is much better to open a support ticket to investigate the cause why your content items do not enter in the search index.

    Anyway what you can do is create a scheduled task as follows:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.SessionState;
    using Telerik.Sitefinity.Abstractions;
    using Telerik.Sitefinity.Data;
    using Telerik.Sitefinity.Scheduling;
      
    namespace SitefinityWebApp
    {
        public class Global : System.Web.HttpApplication
        {
            protected void Application_Start(object sender, EventArgs e)
            {
                Bootstrapper.Initialized += new EventHandler<ExecutedEventArgs>(this.OnSitefinityAppInitialized);
            }
          
            private void OnSitefinityAppInitialized(object sender, EventArgs args)
            {
                SchedulingManager manager = SchedulingManager.GetManager();
                string myKey = "239CE594-5613-42EC-AC57-8E2B33B28065";
          
                var count = manager.GetTaskData().Where(i => i.Key == myKey).ToList().Count;
          
                if (count == 0)
                {
                    PipeScheduledTask newTask = new PipeScheduledTask()
                    {
                        Key = myKey,
                        ExecuteTime = DateTime.UtcNow.AddSeconds(10),
                    };
                    manager.AddTask(newTask);
                    manager.SaveChanges();
                }
            }
        }
      
        public class PipeScheduledTask : ScheduledTask
        {
            public PipeScheduledTask()
            {
            }
           
            public override void ExecuteTask()
            {
                //Your logic here..
                SchedulingManager schedulingManager = SchedulingManager.GetManager();
                PipeScheduledTask newTask = new PipeScheduledTask()
                {
                    Key = this.Key,
                    ExecuteTime = DateTime.UtcNow.AddSeconds(10)
                };
           
                schedulingManager.AddTask(newTask);
                SchedulingManager.RescheduleNextRun();
                schedulingManager.SaveChanges();
            }
           
            public override string TaskName
            {
                get
                {
                    return "SitefinityWebApp.PipeScheduledTask";
                }
            }
        }
          
    }

    The above code snippet is executed every 10sec (you can change this to be executed once in a day or so)

    Then you can try some the solutions to reindex trough Sitefinity API as explained here: Sitefinity 4.4- Searches - How to Programatically Reindex

    Regards,
    Vassil Vassilev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered