Creating custom search functions

A custom search function is a user-defined function that can be included in a search expression. A function is evaluated one time for each search result row.

For an example of a search function in a search expression, see Relational query syntax introduction.

Before you begin

Implement the SearchFunctionHandler interface in either JavaScript or Java™. See Implementing a Search Function Handler.

About this task

You create a search function with a search function definition, which references the implemented search function handler. The search function handler defines the name of the search function in the following format: name-space::short-name. This name must be used in the search expression to reference the search function. The name of a search function and the name of the search function definition for that function can be different.

You cannot use custom search functions in a stored search. You can use these functions in ad hoc or background searches in a SELECT list only.

Tip: To use predefined search functions, install the Reporting Enablement Extensions add-on. For information about these predefined functions, see Search Function Definitions.

Procedure

To create a search function definition:

  1. Start the New Search Function Definition wizard in the administration console:
    1. In the domain navigation pane, select the object store.
    2. In the object store navigation pane, select the Events, Actions, Processes > Search Function Definitions folder.
    3. On the Search Function Definitions tab, click New.
  2. Specify a name for the search function definition that you want to create.
  3. Select a class that is associated with the search function definition.
    You can select either the parent class or a subclass that you created for the search function definition.
  4. Specify whether the search function handler is implemented as a Java component.
    1. If you selected JavaScript, click Next to enter the search function script. You can open and modify a script or add code to the default code stubs. A search function handler that is implemented as JavaScript can fail in some WebLogic configurations. To resolve the problem, see JavaScript action handler fails (WebLogic application server).
    2. If you selected Class, enter the name of the primary Java class for the search function handler. If the Java class is contained in a package, qualify the Java class name with the package it is contained in.

      To configure the code module that contains the search function handler, select Configure Code Module before you click Next. If you do not select this option, the required Java class or JAR file must be on the local Content Platform Engine application server and must be in the application server class path.

  5. Complete the wizard.