Xslt code for specifying query parameters, Adding query parameters to a search form – Google Search Appliance Creating the Search Experience User Manual

Page 122

Advertising
background image

Google Search Appliance: Creating the Search Experience

Advanced Customization Topics

122

XSLT Code for Specifying Query Parameters

The source attribute of the inline frame tag in the “Inline Frame Example page” on page 114 points to
the customized front end, iframe-example-frontend. This front end submits selected parameters as
defined by the XSLT code shown in bold at the bottom of the following code example.

<!-- *** form_params: parameters carried by the search input form *** -->
<xsl:template name="form_params">
<input type="hidden" name="filter" value="0"/>
<xsl:for-each
select="PARAM[@name != 'q' and
@name != 'ie' and
not(contains(@name, 'as_')) and
@name != 'btnG' and
@name != 'btnI' and
@name != 'site' and
@name != 'filter' and
@name != 'swrnum' and
@name != 'start' and
@name != 'access' and
@name != 'ip' and
(@name != 'epoch' or $is_test_search != '') and
not(starts-with(@name ,'metabased_'))]">
<input type="hidden" name="{@name}" value="{@value}" />
<xsl:if test="@name = 'oe'">
<input type="hidden" name="ie" value="{@value}" />
</xsl:if>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:if test="$search_collections_xslt = '' and PARAM[@name='site']">
<input type="hidden" name="site" value="{PARAM[@name='site']/@value}"/>
</xsl:if>

<!--Add these fields to every query string submitted from this front end-->
<input type="hidden" name="getfields" value="rank.price.fly-type" />
<input type="hidden" name="num" value="3" />
</xsl:template>

When users click the search button in this front end, getfields="rank.price.fly-type" and
num="3" are included in the search request along with the standard parameters. Consequently, the
result set will be limited to three results per page, and the specified meta tags will be retrieved for each
result.

Adding Query Parameters to a Search Form

To add query parameters to a front end by modifying the associated stylesheet:

1.

Open the stylesheet in the Admin Console's XSLT Stylesheet Editor or your preferred editor.

2.

Scroll to the following section heading:

<!-- **********************************************************************
Search Parameters (do not customize)
********************************************************************** -->

3.

Within the Search Parameters section, find the section beginning with <!-- *** form_params:
parameters carried by the search input form *** -->. This section contains an XSLT
template named form_params.

Advertising