Portal Express, Version 6.0
Operating systems: i5/OS, Linux, Windows
Displaying search results
You use a search element stored in search component to create the design of the search results.
Use a search component
- Click New->Component->Search to create a new search component.
- Enter identification information.
- Select a search collection to use.
A search element can only search for content created using IBM® Workplace Web Content Management™. You must select a search collection created specifically for Web Content Management. See Configuring a site to be searchable for further information.
- To page the search result:
- Enter the number of results to display per page.
- Select the page to display when first rendered.
- Enter the maximum number of pages to display.
- Enter the number of results pages to read ahead when using a page navigation element. For example, if you enter 3, the page navigation element will calculate results up to 3 pages ahead of the current page. Increasing this number will improve the accuracy of the page navigation element. Lowering this number will improve the performance of the page navigation element when rendered.
To display multiple pages, you will need to use a page navigation element. This is referenced within the header or footer of the search element design specified below.
- Select how the search results should be sorted.
- Define the design of the search results using HTML and text.
- The text entered in the Header and Footer designs will appear before and after the displayed search results. A page navigation element is referenced in either the header or footer to provide users with a way of navigating through the search results.
- The text entered into the Results field defines the format of each search result.
- The text entered into the Separator field will appear between each displayed search result.
- Enter a message to display when no search results are found in the No result design field.
- Set access properties.
- Click Save and close.
Search element design example for use in a Web site
In this example, a table is used to layout the search results.
Header <table>Result The attributes to display in each search result are defined here.
<tr><td> <attributeResource attributeName="namelink"/><br> <attributeResource attributeName="summary"/> </td></tr>Separator A separator can be used to delineate each search result.
<tr> <td bgcolor="#FFFAA" colspan="2"/> </tr>Footer A page navigation element stored in a component is referenced here to add page navigation to the search results.
<tr><td> <component name="pagenavigationcomponent"/> </td></tr> </table>No results There are no results for your query. Please refine your search and try again.
Search element design example for use in a rendering portlet
In this example, a table is used to layout the search results.
Header <table>Result The attributes to display in each search result are defined here.
When displaying search results in a rendering portlet specify the page that the linked content will be displayed in when opened.
A URL map to the portal page that contains the rendering portlet is required. See URL Mapping for further information on creating URL maps.
<tr><td> <a href="/[PORTAL_CONTEXT_ROOT]/[PORTAL_PAGE_URL_MAPPING] /?WCM_GLOBAL_Context=<AttributeResource attributeName="url" />"> <AttributeResource attributeName="title" /></a> <attributeResource attributeName="summary"/> </td></tr>Separator A separator can be used to delineate each search result.
<tr> <td bgcolor="#FFFAA" colspan="2"/> </tr>Footer A page navigation element stored in a component is referenced here to add page navigation to the search results.
<tr><td> <component name="pagenavigationcomponent"/> </td></tr> </table>No results There are no results for your query. Please refine your search and try again.
Search parameters
The following parameters can be used to display data in a search result design using an attribute resource tag:<attributeResource attributeName="parameter" separator=" " format=" "/>
attributeName=authoringtemplate The name of the authoring template, if available, that was used to create the content item. attributeName=author The name or names of the authors of the content item, if any are defined. If there is more than one author, then they will be rendered with the string specified in the optional separator attribute between each value. attributeName=category The categories of the content item if any are defined. If there is more than one category, then they will be rendered with the string specified in the optional separator attribute between each value. attributeName=contentid The id of the content item. attributeName=contentpath The path excluding the server address, port or servlet context (/wps/wcm) for this search result. attributeName=date The value of the date field from the SIAPI result. The format of the date can be specified by using the optional format attribute. See the Javadoc HTML documentation for SimpleDateFormat in the Java SDK for details. attributeName=description The description of the content item. attributeName=effectivedate The effective date of the content item. The format of the date can be specified by using the optional format attribute. See the Javadoc HTML documentation for SimpleDateFormat in the Java SDK for details. attributeName=expirationdate The expiration date of the content item. The format of the date can be specified by using the optional format attribute. See the Javadoc HTML documentation for SimpleDateFormat in the Java SDK for details. attributeName=keywords The keywords of the content item if any are defined. If there is more than one keyword, then they will be rendered with the string specified in the optional separator attribute between each value. attributeName=lastmodifieddate The last modified date of the content item. The format of the date can be specified by using the optional format attribute. See the Javadoc HTML documentation for SimpleDateFormat in the Java SDK for details. attributeName=modifier The name of the last person to modify the content item. attributeName=name The name of the content item. attributeName=namelink This assembles a complete link based on the name of the item being returned. attributeName=owner The name or names of the owners of the content item, if any are defined. If there is more than one author, then they will be rendered with the string specified in the optional separator attribute between each value. attributeName=relevance The relevance “score” for this search result from the search engine. attributeName=summary The summary of the content item as generated by Portal Search. attributeName=title This is the title of a content item. attributeName=titlelink This assembles a complete link based on the title of the item being returned. attributeName=url Displays the URL of a content item. separator=" " Enter text or code to be used to separate multiple search results. For example: separator=" - " format=" " The format of date parameters can be set using this parameter. See the Javadoc HTML documentation for SimpleDateFormat in the Java SDK for details.
Parent topic:
Creating a search form