Integrating External Search

Use

To extend search capabilities of the portal, you can integrate external search providers and make them available in the Search box in the masthead of Ajax Framework Page. You do this with the help of the Search Provider API, contained in the com.sap.portal.search.service package.

Prerequisites

  • SAP NetWeaver Developer Studio is installed and started

  • In the Framework Page Configuration for Ajax Framework Page , the Enable Quick Launch option is selected.

    For more information about enabling this option, see Creating and Editing a Framework Page .

Procedure

The following procedure describes how to implement and integrate a basic search provider that activates an external search engine.

  1. In SAP NetWeaver Developer Studio, open the Enterprise Portal perspective and create a portal application project.

    For more information, see Creating a Portal Application Project .

  2. In portalapp.xml, set a sharing reference to com.sap.portal.search.service.

  3. In the portal application project, create a portal service, and add the startup property, setting it to true.

    For more information, see Creating a Portal Service .

  4. Create a resource bundle named L10N.properties, and add the following keys:

    For more information, see Using Resource Bundles .

  5. In the src.core folder, create a new class named MyHandler that implements the ISearchProviderHandler interface.

  6. Paste the following code into the getDescriptor method of the class:

  7. Paste the following code into the getKey method:

    return "SEARCH_PROVIDER_KEY";

  8. Paste the following code into the getSearchTypes(IUser user, Locale locale) method:

  9. In the deprecated getSearchTypes method, return null.

  10. To register the service, copy the following code to the init method of the service implementation class:

  11. To unregister the service, copy the following code to the destroy method of the service implementation class:

  12. Build and deploy your application. For more information, see Deploying a Portal Application .

  13. In the Provider Configuration screen, add and enable your search provider. For more information, see Configuring Providers .

  14. Refresh the portal, and check that your provider is visible in the Search Options dropdown box.