Skip Headers
Oracle® WebCenter Framework Developer's Guide
10g (10.1.3.2.0)

Part Number B31074-05
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

8 Integrating Oracle Secure Enterprise Search

In WebCenter applications, it may often be useful to provide users with the capacity to search some data or portion of the data presented to them on a page. To achieve this type of functionality, you can use a Web Service data control to call the searching function of Oracle Secure Enterprise Search.

This chapter explains how to integrate search into your WebCenter applications.

For more information, see the Oracle Secure Enterprise Search documentation that comes with the product.

To build a data control that uses Oracle Secure Enterprise Search, perform the following steps:

  1. If you have not already done so, you must install Oracle Secure Enterprise Search by referring to the installation guide for your platform.

  2. If you have not already done so, create an application and a project.

  3. Right-click the project where want to incorporate searching and choose New from the context menu.

  4. Expand Business Tier and select Web Services. If you do not see Web Services, then choose All Technologies from the Filter By list.

  5. In the Items list, choose Web Service Data Control and click OK.

  6. If the Welcome page of the Web Service Data Control Wizard appears, then click Next.

  7. Enter a name for the data control.

  8. Enter a Web Services Description Language (WSDL) URL. The WSDL URL for Oracle Secure Enterprise Search is of the form:

    http://host:port/search/query/OracleSearch?WSDL
    

    Note:

    When Oracle Secure Enterprise Search is installed, the endpoint listed in the WSDL points to a placeholder location. Once the data control is created, you must correct the endpoint URL using the Structure pane. This step will be described later in this procedure.
  9. Click Services. The wizard page should now look similar to Figure 8-1.

    Figure 8-1 Data Source Page of Web Service Data Control Wizard

    Description of Figure 8-1 follows
    Description of "Figure 8-1 Data Source Page of Web Service Data Control Wizard"

  10. Click Next.

  11. From the Data Control Operations page, you choose which methods you want to expose by moving them from the Available list to the Selected list. For the purposes of this example, move doOracleSimpleSearch to the Selected list. When you are done, the page should look similar to Figure 8-2.

    Figure 8-2 Data Control Operations Page of Web Service Data Control Wizard

    Description of Figure 8-2 follows
    Description of "Figure 8-2 Data Control Operations Page of Web Service Data Control Wizard"

  12. For the purposes of this example, you can now click Finish. If you want to review the other pages of the wizard first, then click Next until you reach the end of the wizard and then click Finish.

  13. In the Application Navigator, expand Application Sources and then project_name.

  14. Click DataControls.dcx and its structure will appear in the Structure pane below the Application Navigator.

  15. Right-click your data control in the Structure pane and choose Edt Web Service Connection from the context menu.

  16. The Edit Web Service Connection dialog appears as shown in Figure 8-3. As noted earlier, the endpoint listed in the WSDL points to a placeholder location. You must now correct the endpoint URL.

    Figure 8-3 Edit Web Service Connection Dialog

    Description of Figure 8-3 follows
    Description of "Figure 8-3 Edit Web Service Connection Dialog"

  17. Click OK.

  18. Now you can create a page on which to drop your new data control. Right-click your project and choose New from the context menu.

  19. Under Web Tier, choose JSF. Under Items, choose JSF JSP.

  20. Click OK.

  21. Proceed through the JSF JSP wizard accepting the default settings for everything except File Name. Choose a meaningful file name.

  22. Click Finish when ready.

  23. Once your JSF JSP appears in the editor, click the Data Control tab to bring up the Data Control Palette. You should see your data control displayed in the Data Control Palette. If not, then the previous steps must not have completed successfully or perhaps you are in the wrong application.

  24. Expand the top level node of your data control and then expand Return and Return. You can now see all of the data that is returned by the data control.

  25. For the purposes of this example, drag and drop resultElements onto your page.

  26. Select Tables, ADF Read-only Table from the context menu that appears. The Action Binding Editor appears.

  27. For the sake of simplicity, you can hard code the values for each parameter as shown in Table 8-1.

    Table 8-1 Parameter Values for Action Binding Editor

    Parameter Value

    query

    The string you want to search for, for example, oracle

    startIndex

    1

    docsRequested

    20

    dupRemoved

    false

    dupMarked

    false

    returnCount

    false


  28. When you are done, the dialog should look like Figure 8-4. Click OK.

    Figure 8-4 Action Binding Editor

    Description of Figure 8-4 follows
    Description of "Figure 8-4 Action Binding Editor"

  29. Click OK.

  30. The Edit Table Columns dialog appears. Select lastModified and click Delete (Figure 8-5).

    Figure 8-5 Edit Table Columns Dialog

    Description of Figure 8-5 follows
    Description of "Figure 8-5 Edit Table Columns Dialog"

  31. Click OK.

  32. You must now remove the lastModified column from the page definition as well. Right-click your page in the Structure pane and choose Go To Page Definition from the context menu.

  33. Find <Item Value="lastModified"/> and delete it.

  34. Now you can run your page. Right-click the page in the Application Navigator and choose Run from the context menu.

  35. Browse through your output and notice how occurrences of the word oracle are surrounded by <b></b> tags. Figure 8-6 shows a small sample fragment of this output. Currently, the search hits are not formatted because you have not yet converted the view component that renders this column to OutputFormatted.

    Figure 8-6 Sample of Searched Output, Hits Unformatted

    Description of Figure 8-6 follows
    Description of "Figure 8-6 Sample of Searched Output, Hits Unformatted"

  36. Back in Oracle JDeveloper, return to your JSP by clicking its tab in the editor.

  37. In the Structure pane, find and expand one of the columns that contains oracle, for example, the description column.

  38. Right-click af:outputText - #{row.snippet} for that column and choose Convert from the context menu. The Convert dialog appears.

  39. Select OutputFormatted and click OK.

  40. If the Confirm Convert dialog appears, then click OK again.

  41. Run the page again to see the changes. You should now see output similar to that in Figure 8-7. Notice how the <b></b> around the word oracle is now interpreted so that search hits appear in bold.

    Figure 8-7 Sample of Searched Output, Hits Formatted

    Description of Figure 8-7 follows
    Description of "Figure 8-7 Sample of Searched Output, Hits Formatted"

  42. Using the Structure pane, delete the extraneous columns of your table. When you are done, you should only have row.author, row.title, row.snippet, row.score, and row.language left.

  43. Repeat steps 35 through 40 for each of the columns that remains on your page.

  44. Run the page again. Note how you see automatic pagination in the upper right corner of the table. The reason for this behavior is that the default number of rows for an Oracle ADF table is 10, but you chose to return 20 results. To enhance the page further, you will provide an estimated count.

    From the Data Control Palette, drag and drop estimatedHitCount onto the page. Select Texts, ADF Output Text w/ Label from the context menu.

  45. Another useful feature for this table would be a link to open the document. You can achieve this by dragging a GoLink from under ADF Faces Core in the Component Palette and dropping it right in front of outputFormatted of the title column. Note that you can perform this step a little more accurately in the Structure pane.In the Property Inspector, change the Text attribute to Open.

  46. Right-click the af:goLink - Open in the Structure pane and choose Properties from the context menu.

  47. Click the Bind button next to Destination.

  48. In the Bind to Data dialog, expand the row node under JSP Objects and find the url row and add it to the Expression. Click OK.

  49. Click OK.

  50. Click the Source tab. You should see something similar to the following in the source for your page:

    <af:goLink text="Open" destination="#{row.url}"/>
    
  51. Run the page again. Confirm that the Open link and the estimatedHitCount are present and working properly.

  52. The last feature to add is an input box and a submit button to enable users to perform their own custom searches. Click the Design tab.

  53. Return to the Data Control Palette and expand the first Parameters node under your data control.

  54. Drag query and drop it just above the left corner of your table. Choose Texts, ADF Input Text w/ Label from the context menu.

  55. Drag doOracleSimpleSearch from the Data Control Palette and drop it just below the parameter input box you just created. Choose Methods, ADF Command Button from the context menu.

  56. To avoid getting an error when someone first runs the page, you must set a default value for the query parameter. Go to the page definition, PageDef.xml.

  57. In the Structure pane, expand variables under executables and select doOracleSimpleSearch_query.

  58. In the Property Inspector, select the DefaultValue property and enter a default search, for example, oracle.

  59. Run the page. Enter a different search term in the box and click the button you just created. The results should change.

    Note:

    Because you previously limited the number of results returned, the hit count you added at the bottom of the page is now artificially limited. To fix this problem and get an accurate hit count, find the following line in your PageDef.xml file:
    <NamedData NDName="returnCount" NDValue="false"   NDType="java.lang.Boolean"/>
    

    and change it to:

    <NamedData NDName="returnCount" NDValue="true"
       NDType="java.lang.Boolean"/>