Customizing the Appearance of Search Results

You can customize the default look and feel of the search result list for the default query application.

To customize the appearance of search results: 

  1. On the Global Settings tab, select Configure Search Results List under Out-of-Box Query Application.

    The Configure Search Results List page is displayed.

  2. Select Use Advanced Configuration, then make the desired customizations.

  3. Select attributes to appear in the XML description of result documents.

    The available attributes are local attributes, federated attributes, and internal attributes. Each attribute name appears only one time. That is, the name of a federated attribute with the same name as another attribute or with an explicit mapping to a local search attribute appears only once. Table 5-1 describes Oracle SES internal attributes.

  4. Provide extensible stylesheet language transformations (XSLT) to operate on the selected attributes. The default XSLT is installed at

    ORACLE_HOME/search/webapp/defaults/advanced_config.xsl

    This XSLT transforms XML content into an HTML fragment to be displayed in the result list. If the XSLT is blank, then the untransformed result XML is displayed in the result list. You can use this output for debugging purposes while configuring the XSLT. Invalid XSLTs cannot be saved.

    The output of this transformation should be HTML. Enter the following in the XSLT:

    <xsl:output method="html" />
    
  5. Provide a cascading style sheet (CSS) to style the HTML generated in the XSLT. The default CSS is installed at

    ORACLE_HOME/search/webapp/defaults/advanced_config.css

    This CSS is used along with the included CSS files for the default query application. When there are conflicts between the advanced configuration CSS and the default CSS files, the advanced configuration definitions are used. Default XSLT and CSS style sheets are provided for Advanced Configuration.

Table 5-1 Oracle SES Internal Attributes

Name Type Description

eqcacheurl

String

The URL of the cached version of the document; that is, the value of the "Cached" link in the default result list.

eqcontentlength

Number

The size of the document in bytes.

eqdatasourcename

String

The (untranslated) name of the source where the document originated. This name is local to the instance that the document came from and not the instance that is receiving the document.

If a document comes from a federated source, then the value of this attribute is the name of the source on the federated instance, and not the name of the federated source on the local instance.

eqdatasourcetype

String

The (untranslated) type of source where the document originated. This type is local to the instance from which the document came. For example, Federated is not a valid value for this attribute.

eqdocid

Number

Document ID.

eqfedchain

String

The chain of instance names representing the path of a federated document. The instance names are delimited by a semi-colon (;).

eqfedid

String

The federated source ID chain delimited by an underscore (_).

eqgroupbrowseurl

String

The URL to browse the infosource group; that is, the value of the "Source Group" link in the default result list.

eqlinksurl

String

The URL of the page containing a list of links to the document; that is the value of the "Links" link in the default result list.

eqpathbrowseurl

String

The URL to browse the infosource path; that is, the value of the "Path" link in the default result list.

eqredirecturl

String

The redirect URL to the original document; that is, the value of the title link in the default result list.

eqsimilardoc

Boolean

A value of true indicates a similar document; otherwise, false.

eqsnippet

String

The excerpt or keyword in context of the document.

equserquery

String

The query string.


XML Result Schema

To apply the XSLT, each document is converted into an XML description at query-time with the following schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:element name="result">
   <xsd:complexType>
   <xsd:all>
      <!-- Internal attributes -->
      <xsd:element name="eqdatasourcename" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqdatasourcetype" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqsnippet" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqredirecturl" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqcacheurl" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqlinksurl" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqsimilardoc" type="xsd:boolean" maxOccurs=1 />
      <xsd:element name="eqcontentlength" type="xsd:integer" maxOccurs=1 />
      <xsd:element name="equserquery" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqgroupbrowseurl" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqpathbrowseurl" type="xsd:string" maxOccurs=1 />
      <xsd:element name="eqdocid" type="xsd:integer" maxOccurs=1 />
      <xsd:element name="eqfedid" type="xsd:string" maxOccurs=1 />
      <!-- Built-in search attributes -->
      <xsd:element name="author" type="xsd:string" maxOccurs=1 />
      <xsd:element name="description" type="xsd:string" maxOccurs=1 />
      <xsd:element name="headline1" type="xsd:string" maxOccurs=1 />
      <xsd:element name="headline2" type="xsd:string" maxOccurs=1 />
      <xsd:element name="headline3" type="xsd:string" maxOccurs=1 />
      <xsd:element name="host" type="xsd:string" maxOccurs=1 />
      <xsd:element name="infosource" type="xsd:string" maxOccurs=1 />
      <xsd:element name="infosourcepath" type="xsd:string" maxOccurs=1 />
      <xsd:element name="keywords" type="xsd:string" maxOccurs=1 />
      <xsd:element name="language" type="xsd:string" maxOccurs=1 />
      <xsd:element name="lastmodifieddate" type="xsd:date" maxOccurs=1 />
      <xsd:element name="mimetype" type="xsd:string" maxOccurs=1 />
      <xsd:element name="referencetext" type="xsd:string" maxOccurs=1 />
      <xsd:element name="subject" type="xsd:string" maxOccurs=1 />
      <xsd:element name="title" type="xsd:string" maxOccurs=1 />
      <xsd:element name="url" type="xsd:string" maxOccurs=1 />
      <xsd:element name="urldepth" type="xsd:integer" maxOccurs=1 />
      <!-- Custom search attributes -->
               .
               .
               .
   </xsd:all>
   </xsd:complexType>
   </xsd:element>
</xsd:schema>

XML has the following rules for element names:

  • Alphanumeric and non-English characters, numbers, and ideograms, are allowed

  • Limited punctuation is allowed: underscore, hyphen, and period

  • Names can only begin with letters, ideograms, and underscores

Custom attribute names must conform to these rules for advanced result rendering. To enforce these rules, the empty string replaces all characters that are not permitted by these rules. In addition, Oracle SES search attributes are case-insensitive, and therefore all attributes are converted to lowercase when used in XML format.

For example, suppose the raw XML result data is as follows.

<result>
   <eqdatasourcetype>WEB</eqdatasourcetype>
   <title>Oracle Secure Enterprise Search</title>
   <url>
      http://www.oracle.com/technology/products/oses/index.html
   </url>
      <author>Anonymous</author>
   <description>
      Oracle Secure Enterprise Search 10g, a standalone product from Oracle, enables a secure, high quality, easy-to-use search across all enterprise information assets.
   </description>
 </result>

The following XSLT extracts and formats the title, URL, and author for documents coming from Web sources:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:template match="result[eqdatasourcetype='WEB']">
   <span class="title">
     <xsl:text> &quot;</xsl:text><xsl:value-of select="title" />
     <xsl:text>&quot;</xsl:text>
   </span>
   <span class="author">
     <xsl:text> By </xsl:text><xsl:value-of select="author" />
   </span>
   <br/>
   <span class="url">
     <a href="http://{url}"><xsl:value-of select="url" /></a>
   </span>
 </xsl:template>
</xsl:stylesheet>

A CSS style sheet for this output may be:

.title { font-weight: bold; }
.url { font-style: italic; }

These style sheets produce a final result of:

"Oracle Secure Enterprise Search" By Anonymous

http://www.oracle.com/technology/products/oses/index.html