Running one-off tasks

The SearchService MBean provides commands that allow you to create an indexing optimize task that is scheduled to run once and only once, 30 seconds after being called.

Before you begin

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

About this task

Notes:
  1. If the time between issuing these commands is less than the polling interval for the Search scheduler, then tasks might not execute in the same order as the order in which the commands were issued.
  2. You should wait at least the duration of the poll interval after issuing the following commands before issuing another one of the commands:
    • indexNow()
    • indexNowWithOptimization()
    • optimizeNow()

Procedure

To run one-off Search tasks, complete the following steps.
  1. Start the wsadmin client from one of the following directories on the system on which you installed the Deployment Manager:

    Linux: app_server_root\profiles\dm_profile_root\bin

    Windows: app_server_root/profiles/dm_profile_root/bin

    where app_server_root is the WebSphere® Application Server installation directory and dm_profile_root is the Deployment Manager profile directory, typically dmgr01.

    You must start the client from this directory or subsequent commands that you enter do not execute correctly.

  2. After the wsadmin command environment has initialized, enter the following command to initialize the Search environment and start the Search script interpreter:
    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, you must pick the node where the file is stored.
    When the command is run successfully, the following message displays:
    Search Administration initialized
  3. Use the following commands to run one-off indexing tasks.
    SearchService.indexNow(String applicationNames)

    Creates a one-off task that indexes the specified applications 30 seconds after being called.

    This command takes a single argument:
    • applicationNames. The name (or names) of the HCL 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
      • all_configured
      • blogs
      • calendar
      • communities
      • dogear
      • ecm_files
      • files
      • forums
      • people_finder
      • profiles
      • status_updates
      • wikis.
    Use all_configured instead of listing all indexable services when you want to index all the applications.
    Note: An optimize operation is not run at the end of the indexing operation.
    For example:
    SearchService.indexNow("dogear, blogs")
    The command returns an output in JSON format similar to the following:
    { 
    "success": true, 
    "result": [ 
    "roi-dogear-blogs-SunMay1109:45:02EDT2014" 
    ]
    }
    When the command runs successfully, "success": true, is printed to the wsadmin console. If the command does not run successfully, "success": false is printed to the wsadmin console. The created task name within "result" is always returned.
    SearchService.indexNowWithOptimization(String applicationNames)

    Creates a one-off task that indexes the specified applications 30 seconds after being called, and performs an optimization operation at the end of the indexing operation.

    This command takes a single argument:
    • applicationNames. The name (or names) of the HCL 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
      • all_configured
      • blogs
      • calendar
      • communities
      • dogear
      • ecm_files
      • files
      • forums
      • people_finder
      • profiles
      • status_updates
      • wikis.
    Note: The optimization operation is both CPU and I/O intensive. For this reason, the operation should be performed infrequently and, if possible, during off-peak hours. For more information, refer to the following web page: http://lucene.apache.org/core/old_versioned_docs/versions/3_0_3/api/all/org/apache/lucene/index/IndexWriter.html#optimize%28%29

    Note that when you install HCL Connections, a search optimization task is set up to run every night by default. See Search default tasks for more information.

    For example:
    SearchService.indexNowWithOptimization("dogear, blogs")
    SearchService.optimizeNow()
    Creates a one-off task that performs an optimize operation on the search index, 30 seconds after being called.
    Note: The optimization operation is both CPU and I/O intensive. For this reason, the operation should be performed infrequently and, if possible, during off-peak hours. For more information, refer to the following web page: http://lucene.apache.org/core/old_versioned_docs/versions/3_0_3/api/all/org/apache/lucene/index/IndexWriter.html#optimize%28%29

    Note that when you install HCL Connections, a search optimization task is set up to run every night by default. See Search default tasks for more information.

    This command does not accept any input parameters.

    This operation should not be called during an indexing operation; if it needs to be run, do it at an off-peak time when the application is not expected to be performing intensive I/O operations on the index.