Sun ONE logo     Previous     Contents     Index     Next     
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 stages—input form and results—and 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 menus—is 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
JSPs used by 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:

    /var/opt/SUNWps/https-psservername/portal

  • The following search log file records the search query sent to the Search Engine by the Search server:

    /var/opt/SUNWps/https-psservername/portal/logs/rdm.log

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,

touch searchContent.jsp

or

touch *.jsp

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:

  1. Log in to the iPlanet™ Directory Server Access Management Edition admin console as administrator.

  2. Choose Organizations from the Show menu in User Management.

    All created organizations display in the navigation pane.

  3. Navigate to the organization or sub-organization that you want to configure Search for.

  4. Choose Services from the Show menu.

  5. Click the properties arrow next to Desktop in the Navigation pane.

  6. Click Channel and Container Management.

    The Channels page appears.

  7. In the Channels section, click the Edit link for Search.

    The Edit Channel page appears for the Search channel.

  8. Edit the searchServer property with the Search server's name.

  9. Click Save.

To Add Search Box to Desktop and Display Search Results in a Separate Page

  1. 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.)


    <form name=search action=dt>
    <input type=text name=scope value=Search></td><td></td><td>
    <INPUT TYPE=SUBMIT NAME="Submit" VALUE="Search" CLASS="button"></td>
    <input type=hidden name=action value=content>
    <input type=hidden name=provider value=Search>
    <input type=hidden name=last value=false>
    </form>

    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

  2. Add the three hidden fields to the form in searchContent.jsp, for example:


    <FORM ACTION="dt" NAME="searchform" METHOD=POST
    ENCTYPE="application/x-www-form-urlencoded">
    <INPUT type=hidden name="page" value="1">
    <input type=hidden name=provider value=Search>
    <input type=hidden name=last value=false>
    ...

  3. Add the hidden fields to the Basic, Advanced, and Browse links in searchMenu.jsp.


    href="<%=desktopUrl%>?provider=Search&last=false&mode=basic">Basic Search</a>
    href="<%=desktopUrl%>?provider=Search&last=false&mode=adv">Advanced Search</a>
    href="<%=desktopUrl%>?provider=Search&last=false&mode=browse

  4. Run the touch command.

    For example,

    touch *.jsp

  5. Reload the Desktop to verify the change.

To Add last-modified to the Search Result Display

  1. 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"/>

  2. Modify results.jsp to display the last-modified date for document results using the SOIF getValue tag.

    For example:


    <% if (formbean.getDescription().equals("full")) { %>
    <FONT color=<%=tFontColor%> face=<%=tFontFace%>><search:getValue soifAttribute="description" escape="false"/></FONT><BR>
    <FONT color=#707070 face=<%=tFontFace%>><search:getURL escape="true"/><BR>
    <search:getValue soifAttribute="content-length" id="sz"/>
    <search:getValue soifAttribute="last-modified"/><BR>
    <% } %>

  3. Run the touch command.

    For example,

    touch *.jsp

  4. Reload the Desktop to verify the change.

To Remove content-length from Search Results

  1. (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.

  2. Modify results.jsp by removing the line that displays the content-length.

    The line to modify is the following:


    <% } else if (formbean.getDescription().equals("full")) { %>
         <FONT size=-1 color=<%=tFontColor%> face=<%=tFontFace%>><search:getValue soifAttribute="hl-description" escape="false"/></FONT><BR>
         <FONT size=-1 color=#707070 face=<%=tFontFace%>><search:getValue soifAttribute="hl-url" escape="false"/><BR>
         <search:getValue soifAttribute="content-length" id="sz"/>

    Remove <search:getValue soifAttribute="content-length" id="sz"/> from this line.

  3. Run the touch command.

    For example,

    touch *.jsp

  4. 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.

  1. 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:

    Document matches 1 - 6 (of 6) out of 37

  2. 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:

    Category matches 1 - 2 (of 2) out of 86

  3. Run the touch command.

    For example,

    touch *.jsp

  4. Reload the Desktop to verify the change.

To Remove author from the Advanced Search Interface

  1. Comment our or remove the author related HTM from the advancedSearch.jsp file.

    For example:


    <!-- -->
    <!-- To disclude the "author" row, remark out the following section -->
    <!-- -->
    <TR>
    <td valign=middle align=right height=40><FONT color=<%=tFontColor%> face=<%=tFontFace%>><nobr> <LABEL FOR="advAuthor">Author</LABEL>
    <SELECT NAME="authorOp">
    <OPTION VALUE=<%=SearchContext.CONTAIN%> <%=formbean.authorOpSelection(SearchContext.CONTAIN)%>>does</OPTION>
    <OPTION VALUE=<%=SearchContext.NOTCONTAIN%> <%=formbean.authorOpSelection(SearchContext.NOTCONTAIN)%>>does not</OPTION>
    </SELECT>contain&nbsp;</FONT></nobr></TD>
    <td valign=middle align=left height=40><INPUT TYPE="text" NAME="authorVal" id="advAuthor" VALUE= "<%=SearchContext.htmlEncode(formbean.getAuthorVal())%>"></TD>
    </TR>

  2. Comment out author- related lines in advQuery.jsp.


    // h = new HashMap();
    // h.put(SearchContext.OPERAND, "author");
    // h.put(SearchContext.OPERATION, formbean.getAuthorOp());
    // h.put(SearchContext.VALUE, formbean.getAuthorVal());
    // l.add(h);

    h = new HashMap();
    h.put(SearchContext.OPERAND, "title");

  3. Run the touch command.

    For example,

    touch *.jsp

  4. Reload the Desktop to verify the change.

To Add a New Field to Advanced Search

  1. Uncomment the keywords section from advancedSearch.jsp.


    <!-- -->
    <!-- To Include the "Keywords" row, unremark the following section -->
    <!--
    <TR>
    <td valign=middle align=right height=40><FONT color=<%=tFontColor%> face=<%=tFontFace%>><nobr> <LABEL FOR="advKeywords">Keywords</LABEL>
    <SELECT NAME="keywordsOp">
    <OPTION VALUE=<%=SearchContext.CONTAIN%> <%=formbean.keywordsOpSelection(SearchContext.CONTAIN)%>>does</OPTION>
    <OPTION VALUE=<%=SearchContext.NOTCONTAIN%> <%=formbean.keywordsOpSelection(SearchContext.NOTCONTAIN)%>>does not</OPTION>
    </SELECT>contain&nbsp;</FONT></nobr></TD>
    <td valign=middle align=left height=40><INPUT TYPE="text" NAME="keywordsVal" id="advKeywords" VALUE= "<%=SearchContext.htmlEncode(formbean.getKeywordsVal())%>"></TD>
    </TR>
    -->

    Remove the <!-- and --> comment marks from this section.

  2. 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);

  3. Run the touch command.

    For example,

    touch *.jsp

  4. Reload the Desktop to verify the change.


Previous     Contents     Index     Next     
Copyright 2002 Sun Microsystems, Inc. All rights reserved.

Last Updated August 29, 2002