Search code examples
google-search-appliance

How to set the url without "site" parameter in google search appliance?


 <a class="dn-link" style=" color: #fff;"
    href="{$gsa_search_root_path_prefix}?{$all_results_url}">All results</a> 

From the above url i want to remove the Site parameter because i want to pass my own collection as a site parameter,like below

<a class="dn-link" style=" color: #fff;"
    href="{$gsa_search_root_path_prefix}?{$all_results_url}&amp;site=erp_collection ">  results</a>

Hope some one will help me.


Solution

  • That variable is made from:

    <xsl:variable name="all_results_url"><xsl:value-of
              select="$no_q_dnavs_params"/>&amp;q=<xsl:value-of select="$original_q"/>
    </xsl:variable>
    

    Which is made from:

    <!-- *** url without q and dnavs param *** -->
    <xsl:variable name="no_q_dnavs_params">
      <xsl:for-each
          select="/GSP/PARAM[(@name != 'start') and
                             (@name != $embedded_mode_root_path_param) and
                             (@name != $embedded_mode_resource_root_path_param) and
                             (@name != $embedded_mode_disable_style) and
                             (@name != 'swrnum') and
                             (@name != 'q') and
                             (@name != 'dnavs') and
                             (@name != 'epoch' or $is_test_search != '') and
                             not(starts-with(@name, 'metabased_'))]">
        <xsl:choose>
          <xsl:when test="@name = 'ip' and $show_ips_in_search_url = '0'">
            <!-- do nothing to remove 'ip' from the URL -->
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="@name"/><xsl:text>=</xsl:text>
            <xsl:value-of select="@original_value"/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="position() != last()">
          <xsl:text disable-output-escaping="yes">&amp;</xsl:text>
        </xsl:if>
      </xsl:for-each>
    </xsl:variable>
    

    So you could make your variable up without the site parameter by:

     <xsl:variable name="no_q_dnavs_params">
          <xsl:for-each
              select="/GSP/PARAM[(@name != 'start') and
                                 (@name != $embedded_mode_root_path_param) and
                                 (@name != $embedded_mode_resource_root_path_param) and
                                 (@name != $embedded_mode_disable_style) and
                                 (@name != 'swrnum') and
                                 (@name != 'site') and
                                 (@name != 'epoch' or $is_test_search != '') and
                                 not(starts-with(@name, 'metabased_'))]">
            <xsl:choose>
              <xsl:when test="@name = 'ip' and $show_ips_in_search_url = '0'">
                <!-- do nothing to remove 'ip' from the URL -->
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@name"/><xsl:text>=</xsl:text>
                <xsl:value-of select="@original_value"/>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:if test="position() != last()">
              <xsl:text disable-output-escaping="yes">&amp;</xsl:text>
            </xsl:if>
          </xsl:for-each>
        </xsl:variable>
    

    However, i think you want start, dnavs and query in there. Either way, simply change the != to exclude that parameter from your variable.