Partager via


Crawl schedules do not work

One issue you might have encountered after experiencing some Search problems.Although everything looks ok, the crawl schedules are not respected and the crawler fails to index the content at the specified times.

No errors are logged and if you start the crawl manually , everything works great and the items are indexed ( regardless if you run a full or an incremental crawl).

What you need to know is the crawler schedules are monitored by a timer job , specifically the Indexing Scheduling Manager Timer job.

You can find it in the Central Administration/Operations/TimerJobDefinitions.

As you are aware, the search settings are stored in the database, registry and file system, being kept in sync by a search config. sync timer job. If this task fails to execute, then, you may find yourself into this scenario.

This issue will not be solved by a stop/restart of the Search service (which will make you lose the index) , nor by a re- provision of the Search Service in the farm.

To get out of this problem , get the timer job back and restore the crawl schedule functionality all you need to do is compile the following code into a small console application and run it on the indexer server:

//Code starts Here

//This source code is freeware and is provided on an "as is" basis without warranties of any kind,
//whether express or implied, including without limitation warranties that the code is free of defect,
//fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of
//the code is with the end user.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.Office.Server.Search.Administration;

namespace searchservinstprov
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                SearchServiceInstance myinst = SPServer.Local.ServiceInstances.GetValue<SearchServiceInstance>();
                if (myinst != null)
                {
                    Console.WriteLine("Starting Synchronize");
                    myinst.Synchronize();
                    Console.WriteLine("Synchronize Finished");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
    }
}

//Code ends Here

Save the code as d:\Code.cs and compile it using the csc compiler:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe d:\Code.cs /R:"C:\Program Files\Common files\Microsoft Shared\web server extensions\12\ISAPI\Microsoft.SharePoint.dll" /R:"C:\Program Files\Common files\Microsoft Shared\web server extensions\12\ISAPI\Microsoft.Office.Server.dll" /R:"C:\Program Files\Common files\Microsoft Shared\web server extensions\12\ISAPI\Microsoft.Office.Server.Search.dll"

Thanks Gyorgy https://blogs.msdn.com/gyorgyh

Additional Reference:

https://msdn.microsoft.com/en-us/library/microsoft.office.server.search.administration.searchserviceinstance.synchronize.aspx

Comments