On Mar 26, 2004, at 2:20 AM, Morus Walter wrote:
Erik Hatcher writes:
Why not do the unique sequential number replacement at index time rather than query time?
how would you do that? This requires to know the ids that will be added in future. Let's say you start with strings 'a' and 'b'. Later you add a document with 'aa'. How do you know that you should make 'a' 1 and 'b' 3 to be prepared for 'aa'?
Good point. I haven't thought through this scenario well enough yet.
Hi,
You could form your results into XML and do a simple XSL transformation to get what you want.
<results hits="3" searchStr="boo" searchField="contents"> <result id="a123" label="bbb"/> <result id="c124" label="aaa"/> <result id="b124" label="ccc"/> </results>
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- send sort by param from server, else use default --> <xsl:param name="sortBy" select="'label'"/>
<xsl:template match="results">
<div class="searchInfo">
<xsl:text>You're search for </xsl:text>
<xsl:value-of select="@searchStr"/>
<xsl:text> in </xsl:text>
<xsl:value-of select="@searchField"/>
<xsl:text> returned </xsl:text>
<xsl:value-of select="@hits"/>
<xsl:text> results.</xsl:text>
</div> <div class="results">
<xsl:choose>
<xsl:when test="$sortBy='id'">
<xsl:apply-templates select="result">
<xsl:sort select="@id"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="result">
<xsl:sort select="@label"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</div></xsl:template>
<xsl:template match="result">
<div class="result">
<span class="resultId">
<xsl:value-of select="@id"/>
</span>
<span class="resultLabel">
<xsl:value-of select="@label"/>
</span>
</div></xsl:template>
</xsl:stylesheet>
best, -Rob
Erik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
