Setting Perspectives Attributes of Pages and Items

13 Searching Portal Content 13-1 13 Searching Portal Content This chapter describes how to use the public search APIs provided with Oracle Portal. The search APIs are available in the WWSRC_API package. The public search APIs enable you to search your portal programmatically and return search results as content records or an XML document. Using these APIs, you can design completely custom search forms that seamlessly integrate with Oracle Portal pages. You can also customize how portal search results get displayed on a page; you are no longer limited to the search results portlet provided with Oracle Portal. As the public search APIs can return the results in XML, you may process or format the search results however you require. You can also use the search APIs to display portal content in any custom application. For example, if you have a Web-based application you could easily provide a search form in the application and display the search results from Oracle Portal there as well. The WWSRC_API package provides the following two types of API: ■ Search submissionexecution APIs – Item search – Page search – Category search – Perspective search ■ Search results APIs – Get item results as XML document – Get page results as XML document To determine the structure of the search results returned by the search APIs, refer to the appropriate secure content repository view, as shown in Table 13–1 . Table 13–1 Search Results to Secure View Mapping Search API Secure Content Repository View wwsrc_api.item_search WWSBR_ALL_ITEMS wwsrc_api.page_search WWSBR_ALL_FOLDERS wwsrc_api.category_search WWSBR_ALL_CATEGORIES wwsrc_api.perspective_search WWSBR_ALL_PERSPECTIVES 13-2 Oracle Fusion Middleware Developers Guide for Oracle Portal For example, the results returned by the item_search API have the same structure as the WWSBR_ALL_ITEMS view. For information about the structure of the secure views, refer to Chapter F, Content Management APIs and Views . This chapter contains the following sections: ■ Section 13.1, Searching For Items Across All Page Groups ■ Section 13.2, Searching For Pages in Specific Page Groups ■ Section 13.3, Searching For Items By Attribute ■ Section 13.4, Transforming Search Results into XML ■ Section 13.5, Displaying Search Results For the examples in the following sections, you need to enable output in SQLPlus. To do this log on to SQLPlus as the portal schema owner and enter the following command: SQL SET SERVEROUTPUT ON For more information about the public search APIs, refer to the Oracle Portal PLSQL API Reference on Portal Center: http:portalcenter.oracle.com In the Portal Focus Areas section, click Portlet Development, and then click PLSQL API Reference APIs and References section.

13.1 Searching For Items Across All Page Groups

Example 13–1 uses the item_search API to search all the page groups in your portal for items that contain the term portal. Example 13–1 Searching Across All Page Groups item_search API declare l_results wwsrc_api.items_result_array_type; l_count number; l_scores wwsrc_api.number_list_type; begin l_results := wwsrc_api.item_search p_mainsearch = portal, p_out_count = l_count, p_out_scores = l_scores ; dbms_output.put_lineNumber of results: || l_count; exception ... end; ■ p_mainsearch is the keyword or term for which you want to search. This may be any value, including an Oracle Text query expression. ■ p_out_count is the number of search hits. Tip: Remember, if you are calling the APIs from a Web provider or external application, you need to set the session context first. For more information, refer to Section 10.1, Setting the Session Context .