Skip to main content link. Accesskey S
  • HCL Logo
  • Digital Experience Wiki
  • THIS WIKI IS READ-ONLY.
  • HCL Forums and Blogs
  • Home
  • Product Documentation
  • API Documentation
Search
Community Articles > WebSphere Portal > Search for WebSphere Portal > Customizing WebSphere Portal 8 Search Results
  • Share Show Menu▼
  • Subscribe Show Menu▼

Recent articles by this author

Customizing WebSphere Portal 8 Search Results

This article shows two options to change the look of search results in WebSphere Portal Server 8 search center. The first one is the display of search results and the second one is the search term reloationship. Change the Search Result Display Table To display the search results in different ...
Community articleCustomizing WebSphere Portal 8 Search Results
Added by ~Hal Frowemanli on April 15, 2022 | Version 1
  • Actions Show Menu▼
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: WebSphere Portal, search
This article shows two options to change the look of search results in WebSphere Portal Server 8 search center. The first one is the display of search results and the second one is the search term reloationship.

Change the Search Result Display Table

To display the search results in different formats, the following files in the Search Center Portlet application need to be modified.

//Profiles/wp_profile/installedApps/DmgrWPCell/PA_Search_Center.ear/searchCenter.war/js/ibm/portal/search/SearchCenter/xslt/result.xsl

This result.xsl file is used to process the search result atom feed. The default results are displayed similar to the one below. The standard columns are Relevance, Icon, Title, Person, and Date.

The default result.xsl controls the display format. To customize the display to suit your organization needs, the display table section inside the result.xsl needs to be modified. Use the Extensible Stylesheet Language to modify the table section of the result.xsl, the search result display can be changed to the one shown below.

In this case, only two columns are used in the table. The first column displays the file type and the second column display the title. Attached is the snippet of the modified result.xsl. When the result document is coming from the WCM content, the default icon is shown in the first column. When the result is a file, the first column shows the file extension based on the mime type. The titles for those files are coming from the first part of the summary field and are shown in the second column of the result table.


<td width="2%">


<xsl:choose>


<xsl:when test="substring-after(atom:link/@type,'/') = 'html'">


<img width="16" height="16" border="0" align="middle">


<xsl:attribute name="src">


<xsl:value-of select="$serverPath"/><xsl:value-of select="atom:link[@rel='icon']/@href"/>


</xsl:attribute>


<xsl:attribute name="title">


<xsl:value-of select="atom:category/@label"/>


</xsl:attribute>


<xsl:attribute name="alt">


<xsl:value-of select="atom:category/@label"/>


</xsl:attribute>


</img>


</xsl:when>


<xsl:otherwise>


<xsl:choose>


<xsl:when test="substring-after(atom:link/@type,'/') = 'pdf'">[PDF]</xsl:when>


<xsl:when test="substring-after(atom:link/@type,'/') = 'vnd.ms-excel'">[XLS] </xsl:when>


<xsl:when test="substring-after(atom:link/@type,'/') = 'vnd.openxmlformats-officedocument.wordprocessingml.document'">[DOCX]</xsl:when>


<xsl:when test="substring-after(atom:link/@type,'/') = 'msword'">[DOC] </xsl:when>


<xsl:when test="substring-after(atom:link/@type,'/') = 'plain'">[TXT] </xsl:when>


<xsl:when test="substring-after(atom:link/@type,'/') = 'txt'">[TXT] </xsl:when>


<xsl:when test="substring-after(atom:link/@type,'/') = 'zip'">[ZIP] </xsl:when>


<xsl:when test="substring-after(atom:link/@type,'/') = 'csv'">[CSV] </xsl:when>


<xsl:otherwise>[FILE]</xsl:otherwise>


</xsl:choose>


</xsl:otherwise>


</xsl:choose>


</td>


<td width="98%">


<h4>


<a class="entryURL" href="{concat($serverPath, atom:link[(@rel='alternate') or not(@rel)]/@href)}">


<xsl:attribute name="type">


<xsl:value-of select='atom:link/@type' />


</xsl:attribute>


<span style="display: none">


<span>


<xsl:value-of select="wplc:field[@id='contentSourceType']"/>


</span>


<span>


<xsl:value-of select="wplc:field[@id='PortletWindowId']"/>


</span>


<span>


<xsl:value-of select="wplc:field[@id='NavigationNode']"/>


</span>


<span>


<xsl:choose>


<xsl:when test="substring-after(atom:link/@type,'/') = 'html'">


<xsl:value-of select="atom:title" disable-output-escaping="yes" />


</xsl:when>


<xsl:otherwise>


<xsl:choose>


<xsl:when test="string-length(substring-after(atom:summary,'/Strong> ')) &gt; 0">


<xsl:choose>


<xsl:when test="string-length(substring-after(atom:summary,'/Strong> ')) &lt; 70">


<xsl:value-of select="substring(substring-after(atom:summary,'/Strong> '),1,string-length(substring-after(atom:summary,'/Strong> ')))" disable-output-escaping="yes" />...


</xsl:when>


<xsl:otherwise>


<xsl:value-of select="substring(substring-after(atom:summary,'/Strong> '),1,70)" disable-output-escaping="yes" />...


</xsl:otherwise>


</xsl:choose>


</xsl:when>


<xsl:otherwise>


<xsl:value-of select="atom:title"/>


</xsl:otherwise>


</xsl:choose>


</xsl:otherwise>


</xsl:choose>


</span>


<span>


<xsl:value-of select="atom:id"/>


</span>


</span>


<xsl:choose>


<xsl:when test="substring-after(atom:link/@type,'/') = 'html'">


<xsl:value-of select="atom:title" disable-output-escaping="yes" />


</xsl:when>


<xsl:otherwise>


<xsl:choose>


<xsl:when test="string-length(substring-after(atom:summary,'/Strong> ')) &gt; 0">


<xsl:choose>


<xsl:when test="string-length(substring-after(atom:summary,'/Strong> ')) &lt; 70">


<xsl:value-of select="substring(substring-after(atom:summary,'/Strong> '),1,string-length(substring-after(atom:summary,'/Strong> ')))" disable-output-escaping="yes" />...


</xsl:when>


<xsl:otherwise>


<xsl:value-of select="substring(substring-after(atom:summary,'/Strong> '),1,70)" disable-output-escaping="yes" />...


</xsl:otherwise>


</xsl:choose>


</xsl:when>


<xsl:otherwise>


<xsl:value-of select="atom:title"/>


</xsl:otherwise>


</xsl:choose>


</xsl:otherwise>


</xsl:choose>


</a>


</h4>


<div class="preFormatted lotusDetails"><xsl:value-of select="atom:summary" disable-output-escaping="yes" /></div>


<div>


<a class="tagWidgetLink" href="javascript:;" style="display: none;"><xsl:value-of select="$editKeywords"/></a>


<xsl:if test="wplc:field/@id='tag'">


<span class="lotusDivider" style="display: none;">|</span>


<span class="lotusTags"><xsl:value-of select="$tags"/>&#160;


<xsl:for-each select="wplc:field">


<xsl:if test="@id='tag'">


<span class="tagLink"><xsl:value-of select='text()'/></span>


<xsl:if test="position() != last()"><span>, </span></xsl:if>


</xsl:if>


</xsl:for-each>


</span>


</xsl:if>


</div>


</td>


Changing the default search logic.

In WebSphere Portal 8 search center, the default search logic for the entry is the “OR” logic. To change the search logic to the “AND” relationship, the properties in the search collection configuration have to the modified. After the crawler finish running for the first time, do the following steps.

1) Login to the Remote Search Server

2) Search for the search collection configuration file. There should be one configuration file for each collection. The name is in this format

collection_config_***.xml

where *** is some a sequence of generated alphanumeric numbers. The files could likely in the directory /apps/SCE/search/config/

3) Add the following property to the list of properties:
<property name="DEFAULT_SEARCH_OPERATOR" value="and"/>.
It should be in the collectionInfo tag.

4) Save the changes to all configuration files.

5) Restart the remote search servers only.


  • Actions Show Menu▼


expanded Attachments (0)
collapsed Attachments (0)
Edit the article to add or modify attachments.
expanded Versions (1)
collapsed Versions (1)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (1)Apr 15, 2022, 3:45:34 PM~Hal Frowemanli  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedAbout