|
|
| Sun ONE Portal Server 6.0 Desktop Customization Guide |
Chapter 7 Customizing the Search Provider
This chapter provides common customization tasks for modifying the Search provider.
This chapter contains the following sections:
Overview of Customizing the Search Provider
The Search provider (SearchProvider) furnishes a basic reference user interface that contains both search and browse functionality. Search functionality includes basic search mode, and advanced search for more complex searches. You can perform specific field searches in advanced search mode. For example, while in advanced mode, you can search within the title, URL, last modified date, author, and so on.
SearchProvider provides a link for category browsing. In addition, you can create a taxonomy on the Search Engine along with category filter rules. You can browse through the taxonomy tree and view documents within a category through the Search provider interface.
Search Provider Design
The Search provider uses JSPProvider to access Sun ONE Portal Server backend services. The Search provider users JavaServer Pages (JSP) helper tag libraries to avoid using Java scriptlets. The Search Engine is a global service list type attribute that is configured and updated at installation time. The Search provider is responsible for directing the search request to the appropriate backend Search Engine server.
See "Display Profile Definition for SearchProvider" for the display profile properties you can set for the provider.
Search JavaServer Pages and Tag Libraries
The Search provider consists of two stagesinput form and resultsand the JSPs used by the Search provider fall into one of those two stages.
Figure 7-1 explains the JSP layout for searchContext.jsp. In the input stage (Stage 1), searchContent.jsp makes use of searchMenu.jsp and psSearch.jsp to set up the initial interface. basicSearch.jsp is used for a basic search and advancedSearch.jsp for an advanced search. The description menu that is, the Full, Brief, and Title menusis displayed for both basic and advanced searches by descMenu.jsp. browseHeader.jsp contains the browse-related code that shows up in the browse interface.
In the results stage (Stage 2), one of three JSPs is used: browseOnly.jsp, which sets and executes the parameters for category browsing using the Search tag library, and includes the browseResults.jsp page; browseSearch.jsp, which sets and executes the parameters for searching and browsing within categories using the Search tag library and includes browseSearchResults.jsp; and searchOnly.jsp, which sets and executes the parameters for search using search the Search tag library and includes results.jsp and score.jsp for the match relevance. pageFooter.jsp displays the list of pages, Next, and Previous links.
Figure 7-1    JSP Layout for searchContent.jsp
![]()
See Appendix C "JavaServer Pages Reference" for more information on the Search JSP files.
The Search JSPs use the following tag libraries, which ship with Sun ONE Portal Server:
Jakarta tag library, for any generic tags
Desktop tag library, for Sun ONE Portal Server related information
Search tag library to cover all Search Engine server access functionality and to server as primarily as a tag wrapper for the existing public search and SOIF API See Appendix B "JavaServer Pages Tag Library Reference" for more information.
Tips for Customizing the Search Provider
This section provides some basic tips for customizing the Search provider.
Debugging the Search Provider
Sun ONE Portal Server provides files to help debug the Search provider.
The following directory contains various search log files: The following search log file records the search query sent to the Search Engine by the Search server: See the Sun ONE Portal Server 6.0 Administrator's Guide for more information about the Search log files.
Location of Search JavaServer Pages
JavaServer Pages for the Search channel are in the /etc/opt/SUNWps/desktop/default/Search directory.
Modifying Search JavaServer Pages
When you modify Search JavaServer Pages, be sure to run the touch command, otherwise no changes are reflected. You need to either run the touch command on the top-level Search JSP file, searchContent.jsp, or on all JSP files. For example,
See "JavaServer Page Caching Information" and "Recompiling JSPs" for more information.
Accessing Search Channel Directly
You can also access the search channel directly at the following URL:
http://psserver:port/portal/dt?action=content&provider=Search&last=false Customizing the Search Provider
This section describes how to perform some common customizations on the Search provider.
To Modify the Default Search Server
When you install Sun ONE Portal Server, the Search provider is linked back to the Search server by default. That is to say, the Search provider can connect to any Search server, but by default the value for the searchServer property is set to the following:
http://server:port/portal/search
The searchServer property is normally initialized to the current portal server system during the sample portal installation but this property is not set when you create a new organization or a new custom search channel. See Chapter 8, "Administering the Sun ONE Portal Server Search Engine" in the Sun ONE Portal Server 6.0 Administrator's Guide for information on configuring the searchServer property for the Search provider.
To modify the default search server:
Log in to the iPlanet Directory Server Access Management Edition admin console as administrator.
Choose Organizations from the Show menu in User Management.
Navigate to the organization or sub-organization that you want to configure Search for.
Choose Services from the Show menu.
Click the properties arrow next to Desktop in the Navigation pane.
Click Channel and Container Management.
In the Channels section, click the Edit link for Search.
Edit the searchServer property with the Search server's name. To Add Search Box to Desktop and Display Search Results in a Separate Page
Add the following HTML form lines to the JSP where you want the search box to appear (for example, /etc/opt/SUNWps/desktop/default/
JSPTableContainerProvider/tabtable.jsp.)
The target for the form is the Desktop. When you set provider=Search the Desktop invokes the Search channel on the page. You set last=false so that the Desktop does not set the provider value to Search permanently. If the last value is not set then users cannot get back to the Desktop using the following link:
http://server:port/portal/dt
Add the three hidden fields to the form in searchContent.jsp, for example:
Add the hidden fields to the Basic, Advanced, and Browse links in searchMenu.jsp.
Reload the Desktop to verify the change. To Add last-modified to the Search Result Display
Modify searchOnly.jsp by adding last-modified to the list of viewAttributes.
For example:
<search:setViewAttributes viewAttributes="hl-url,hl-title,hl-description,score,content-length,hl-classif ication,last-modified"/>
Modify results.jsp to display the last-modified date for document results using the SOIF getValue tag.
For example:
Run the touch command.
Reload the Desktop to verify the change. To Remove content-length from Search Results
(Optional) Modify searchOnly.jsp by removing content-length from the list of viewAttributes.
The line to modify is the following:
<search:setViewAttributes viewAttributes= "hl-url,hl-title,hl-description,score,content-length,classification
hl-classification"/>
Remove ,content-length from this line.
Modify results.jsp by removing the line that displays the content-length.
The line to modify is the following:
Remove <search:getValue soifAttribute="content-length" id="sz"/> from this line.
Run the touch command.
Reload the Desktop to verify the change. To Display the Total Documents in the Search Result Status Message
In this procedures, Steps 1 and 2 are independent of each other. If desired, run the touch command after Step 1 to see the results.
Modify results.jsp by changing the search status line to add the <search:getTotalDocuments/> tag.
For example:
<NOBR><B>Document matches <search:getFirstHit/> - <search:getToHit/> (of <search:getHitCount/>)</B> out of <search:getTotalDocuments/></NOBR><BR>
This results in the following display: Change browseResults.jsp by adding the <search:getTotalDocuments/> tag to the search status.
For example:
<FONT color="<%=tFontColor%>" face="<%=tFontFace%>" size="-1"><b>Subcategories <search:getFirstHit/> - <search:getToHit/> (of <search:getHitCount/>)</B> out of <search:getTotalDocuments/></FONT><br>
This results in the following display: Run the touch command.
Reload the Desktop to verify the change. To Remove author from the Advanced Search Interface
Comment our or remove the author related HTM from the advancedSearch.jsp file.
For example:
Comment out author- related lines in advQuery.jsp.
Reload the Desktop to verify the change. To Add a New Field to Advanced Search
Uncomment the keywords section from advancedSearch.jsp.
Add the keywords to advQuery.jsp.
h = new HashMap();
h.put(SearchContext.OPERAND, "keywords");
h.put(SearchContext.OPERATION, formbean.getKeywordsOp());
h.put(SearchContext.VALUE, formbean.getKeywordsVal());
l.add(h);
Reload the Desktop to verify the change.
Previous Contents Index Next
Copyright 2002 Sun Microsystems, Inc. All rights reserved.
Last Updated August 29, 2002