This chapter provides common customization tasks for modifying the Search provider and Discussion 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 for 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.
The Search provider uses JSPProvider to access the Portal Server back end services. The Search provider users JavaServer PagesTM (JSPTM) helper tag libraries to avoid using JavaTM scriptlets. The searchServer 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 back end Search Engine server.
See the Sun Java System Portal Server 7.2 Technical Reference for the display profile properties you can set for the provider.
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.
The following Example 80–1explains the JSP layout for searchContent.jsp. In the input stage (Stage 1), searchContent.jsp makes use of searchMenu.jsp and psSearch.jsp to set up the initial interface. The basicSearch.jsp file is used for a basic search and advancedSearch.jsp file 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 file. The browseHeader.jsp file defines the browse interface.
In the results stage (Stage 2), one of three JSPs is used: browseOnly.jsp file sets and executes the parameters for category browsing using the Search tag library, and includes the browseResults.jsp page; browseSearch.jsp file sets and executes the parameters for searching and browsing within categories using the Search tag library and includes browseSearchResults.jsp; and searchOnly.jsp file sets and executes the parameters for search using search the Search tag library and includes results.jsp and score.jsp for the match relevance. The pageFooter.jsp file displays the list of pages, Next, and Previous links.
searchContent.jsp | |------>searchMenu.jsp | |------>psSearch.jsp | |------>basicSearch.jsp----->descMenu.jsp (if search mode is basic) | |------>advancedSearch.jsp-->descMenu.jsp (if search mode is advanced) | |------>browseHeader.jsp (if browse mode is selected) | | STAGE 1 INPUT _______________________________________________________________________________ | | | | STAGE 2 INPUT | | | |--->browseOnly.jsp----->browseResults.jsp (category browsing in browse mode) | |------>browseSearch.jsp--->browseSearchResults.jsp (only for category search) | |------>searchOnly.jsp----->results.jsp--->score.jsp(displays the match relevance) | |------>pageFooter.jsp
See the Sun Java System Portal Server 7.2 Technical Reference for more information on the Search JSP files.
The Search JSPs use the following tag libraries, which ship with the Portal Server software:
Desktop tag library, for the Portal Server software related information
Search tag library to cover all Search Engine server access functionality and to provide a tag-based wrapper for the existing public search and SOIF API
See the Sun Java System Portal Server 7.2 Technical Reference for more information.
The Portal Server software provides files to help debug the Search Providers.
The following directory contains various search log files:
PortalServer-DataDir/searchservers/search1/logs |
The following search log file records the search query sent to the Search Engine by the Search server:
PortalServer-DataDir/searchservers/search1/logs/rdm.0.0.log |
This section describes how to perform some common customizations on the Search provider.
Modify searchOnly.jsp file by adding last-modified to the list of viewAttributes.
For example:
<search:setViewAttributes viewAttributes="hl-url,hl-title,hl-description,score,content-length,hl-classification,last-modified"/> |
Modify results.jsp file 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> <% } %> |
Run the touch command.
For example, type touch *.jsp.
Reload the Desktop to verify the change.
(Optional) Modify searchOnly.jsp file 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 file by removing the line that displays the content-length.
Comment the lines as shown here:
<%-- <search:getValue attribute="content-length" id="sz"/> <jx:declare id="sz" type="java.lang.String"/> <% int sizek = 1; try { sizek = Math.max(1, (Integer.parseInt(sz) + 512)/1024 ); } catch (Exception e) { } %> <i18n:message key="size" bundle="searchjsp"/> <%= sizek %>k --%>" |
Run the touch command.
For example, type touch *.jsp.
Reload the Desktop to verify the change.
Comment out or remove the author related HTML 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 </FONT></nobr></TD> <td valign=middle align=left height=40><INPUT TYPE="text" NAME="authorVal" id="advAuthor" VALUE= "<%=SearchContext.htmlEncode(formbean.getAuthorVal())%>"></TD> </TR> |
Comment out author- related lines in advQuery.jsp file.
if (!formbean.getAuthorVal().equals("")) { h = new HashMap(); h.put(SearchContext.OPERAND, "author"); h.put(SearchContext.OPERATION, formbean.getAuthorOp()); h.put(SearchContext.VALUE, formbean.getAuthorVal()); l.add(h); } |
Run the touch command.
For example, type touch *.jsp.
Reload the Desktop to verify the change.
Uncomment the keywords section in advancedSearch.jsp file.
<!-- --> <!-- 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 </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.
Add the keywords to advQuery.jsp file.
if (!formbean.getKeywordsVal().equals("")) { h = new HashMap(); h.put(SearchContext.OPERAND, "Keywords"); h.put(SearchContext.OPERATION,formbean.getKeywordsOp()); h.put(SearchContext.VALUE, formbean.getKeywordsVal()); l.add(h); } |
Run the touch command.
For example, type touch *.jsp.
Reload the Desktop to verify the change.
Type the following URL in your browser:
http://server:port/portal/dt?provider=JSPDynamicSingleContainer&JSPDynamicSingleContainer.selectedChannel=Search&last=false&action=content |
Modify all the links to use these extra parameters in the URL. For example, edit searchMenu.jsp file as follows:
<nobr> <a class=noUnderline href="<%=dpurl%>?mode=basic">Basic Search</a> </nobr> |
Replace the bold portion with:
http://server:port/portal/dt?provider=JSPDynamicSingleContainer&JSPDynamicSingleContainer.selectedChannel=Search&last=false&action=content |