Add scheduled tasks for Search 

Use SearchService administrative commands to add scheduled task definitions for the Search application to the Home page database.


Before starting

To use SearchService administrative commands, use the wsadmin client. See Starting the wsadmin client for information about how to start the wsadmin command-line tool.


About this task

The SearchService commands are used to access a service that provides an administrative interface for adding scheduled indexing task definitions to the Home page database. The following applications can be indexed: Activities, Blogs, Bookmarks, Communities, Files, Forums, Profiles, and Wikis.

When defining a scheduled task in the Home page database, you need to specify when the scheduler starts the task. The schedule is defined using a Cron schedule. For more information about the scheduler, see Scheduling tasks.

It is not possible to specify an end time for an indexing task. All tasks run as long as they need to. The startby interval defines the time period by which a task can fire before it is automatically canceled. This mechanism ensures that tasks do not queue up for an overly long period before being canceled, and allows for tasks that run for longer than the default indexing schedule, such as initial index creation.


Procedure

To define a scheduled task for the Search application...

  1. From the dmgr host:

      cd $DMGR_PROFILE/bin
      ./wsadmin.sh -jython
      execfile("searchAdmin.py")

      If prompted to specify a service to connect to, type 1 to pick the first node in the list. Most commands can run on any node. If the command writes or reads information to or from a file using a local file path, pick the node where the file is stored.

  2. Use the following commands to add scheduled task definitions in the Home page database.

      SearchService.addIndexingTask(String taskName, String schedule, String startBy, String applicationNames, Boolean optimizeFlag)

        Creates a new scheduled indexing task definition in the Home page database.

        This command takes the following arguments:

        • taskName. The name of the scheduled task. This argument is a string value, which must be unique.

        • schedule. The time at which the scheduled task starts. This argument is a string value that must be specified in Cron format.

        • startBy. The time given to a task to fire before it is automatically canceled. This argument is a string value that must be specified in Cron format.

            This parameter should be used to ensure that indexing tasks are not queued up and running into server busy times. Under normal conditions, the only factors that might cause a task to be delayed are that overlapping or coincident tasks are trying to fire at the same time, or an earlier task is running for a long time.

        • applicationNames. The name (or names) of the IBM Connections application to be indexed when the task is triggered. This argument is a string value. To index multiple applications, use a comma-delimited list. The following values are valid: activities, blogs, communities, dogear, files, forums, profiles, and wikis.

        • optimizeFlag. A flag that indicates if an optimization step should be performed after indexing. This argument is a boolean value.

        All arguments are required.

        For example:

        SearchService.addIndexingTask("customDogearAndBlogs", "0 0 1 ? * MON-FRI", "0 10 1 ? * MON-FRI", "dogear,blogs","true")

        Note: The refreshTasks() command should be used after this command for the new task definitions to take effect immediately. Otherwise, the changes take place when the Search application is next restarted.

      SearchService.addOptimizeTask(String taskName, String schedule, String startBy)

        Creates a new index optimization scheduled task definition.

        This command takes the following arguments:

        • taskName. The name of the scheduled task. This argument is a string value, which must be unique.

        • schedule. The time at which the scheduled task starts. This argument is a string value that must be specified in Cron format.

        • startBy. The time given to a task to fire before it is automatically canceled. This argument is a string value that must be specified in Cron format.

            This parameter should be used to ensure that indexing tasks are not queued up and running into server busy times. Under normal conditions, the only factors that might cause a task to be delayed are that overlapping or coincident tasks are trying to fire at the same time, or an earlier task is running for a long time.

        All arguments are required.

        For example:

        SearchService.addOptimizeTask("customOptimize", "0 0 1 ? * MON-FRI", "0 10 1 ? * MON-FRI")

        Note: The refreshTasks() command should be used after this command for the new task definitions to take effect immediately. Otherwise, the changes take place when the Search application is next restarted.

  3. To refresh the Home page database to include the newly-added tasks, use the following command:

      SearchService.refreshTasks()


Parent topic

Configure scheduled tasks

Related concepts
Scheduling tasks

Related reference
SearchService commands

+

Search Tips   |   Advanced Search