Skip to content

Instantly share code, notes, and snippets.

@tingletech
Created October 6, 2010 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tingletech/612901 to your computer and use it in GitHub Desktop.
Save tingletech/612901 to your computer and use it in GitHub Desktop.
<xsl:stylesheet>
<!-- in xtf queryParser.xsl -->
<!-- autocomplete on title -->
<xsl:template match="/" mode="autocomplete">
<xsl:variable name="stylesheet" select="'style/crossQuery/resultFormatter/oac4/autoFormatter.xsl'"/>
<query indexPath="index" termLimit="1000" workLimit="20000000"
style="{$stylesheet}" startDoc="{$startDoc}" maxDocs="20" normalizeScores="false">
<and maxSnippets="0">
<!-- additional search limits -->
<and field="title">
<xsl:apply-templates select="parameters/param[@name='query']/token" mode="autotitle"/>
</and>
</and>
</query>
</xsl:template>
<!-- do a wildcard search on the last word -->
<xsl:template match="token[position()=last()]" mode="autotitle">
<xsl:variable name="value">
<xsl:value-of select="@value"/>
<xsl:text>*</xsl:text>
</xsl:variable>
<or>
<near slop="13"><term><xsl:value-of select="$value"/></term></near>
<near slop="13"><term><xsl:value-of select="@value"/></term></near>
</or>
</xsl:template>
<xsl:template match="token" mode="autotitle">
<term><xsl:value-of select="@value"/></term>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment