Generating Search Results in XML Workaround for get_item_xml

13-10 Oracle Fusion Middleware Developers Guide for Oracle Portal 7. On the Layout page, choose the columns you want to display in the portlet and how you want them to appear.

8. Click Finish to create the OmniPortlet instance.

13.5.2 Displaying Search Results in a Dynamic Page

The following two examples show how to display search results in a dynamic page portlet. Users can then add this portlet to any page within your portal. To do this, perform the following steps: 1. Create a procedure that the dynamic page can call to perform the search. The procedure in Example 13–7 uses the item_search API to search for a specified term searchterm and displays only those results with a score higher than a specified value score. Example 13–7 Procedure to Perform the Search create or replace procedure search_resultssearchterm varchar2, score number as x varchar2100; y number; l_results wwsrc_api.items_result_array_type; l_count number; l_scores wwsrc_api.number_list_type; begin x := searchterm; y := score; l_results := wwsrc_api.item_search p_mainsearch = x, p_out_count = l_count, p_out_scores = l_scores ; htp.pNumber of total hits: || l_count; htp.pbr; htp.pbr; for i in 1..l_results.count loop if l_scoresi y then htp.pb || i || b - a href= || l_resultsi.url || || l_resultsi.display_name || a; htp.pbr; htp.pscore = || l_scoresi; htp.pbr; end if; end loop; exception ... end; grant execute on search_results to public; For information about the item_search API used in Example 13–7 , refer to Section 13.1, Searching For Items Across All Page Groups .

2. Create the dynamic page.

Note: You must create the procedure in the database in which your portal resides. Searching Portal Content 13-11 A dynamic page is one of the portlets you can build using the Oracle Portal Portlet Builder. For more information about Portlet Builder, refer to the Oracle Fusion Middleware Developers Guide for Oracle Portal. For more information about building dynamic pages, refer to the Oracle Portal online Help. Example 13–8 shows the code to use for the dynamic page. Example 13–8 Code for Dynamic Page to Display Results html head titleExample for Search API UItitle head body h2My Search Formh2 oracle declare x varchar2100; y number; begin x := :searchterm; y := :score; schemaname.search_resultsx,y; end; oracle body html 3. Provide default values for the two bind variables defined in the HTML code so that the dynamic page displays some results Figure 13–1 . Figure 13–1 Providing Default Values for Bind Variables 4. Make sure the dynamic page is available as a portlet. 5. You can now add this dynamic page portlet to any page in your portal. The dynamic page portlet displays search results based on the default values provided when you created the dynamic page, as shown in Figure 13–2 . Tip: Replace schema with the name of the schema in which you created your procedure. Tip: You should find the portlet in the Staging Area of the Portlet Repository under the name of the provider in which you created it. 13-12 Oracle Fusion Middleware Developers Guide for Oracle Portal Figure 13–2 Default Search Results Displayed in the Dynamic Page Portlet 6. Users can personalize this portlet to provide their own search term and minimum score, as shown in Figure 13–3 . Figure 13–3 Personalizing Search Criteria In Figure 13–4 you can see the changes in the search results when a user personalizes the portlet and changes the minimum score to 70. Figure 13–4 Personalized Search Results Displayed in the Dynamic Page Portlet