Changeset 26372


Ignore:
Timestamp:
10/23/12 14:43:43 (8 years ago)
Author:
kjdon
Message:

display num matching docs. Also display term info even if no matching docs - if doing multiword query its helpful to see what terms were found

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/query.xsl

    r26368 r26372  
    3030    <xsl:template name="resultsPage">
    3131        <xsl:call-template name="resultsPagePre"/>
     32    <xsl:call-template name="displayMatchDocs"/>
    3233        <xsl:call-template name="displayTermInfo"/>
    3334        <xsl:call-template name="displayResults"/>
     
    155156        </xsl:for-each>
    156157    </xsl:template>
    157    
     158    <xsl:template name="displayMatchDocs">
     159    <div id="matchdocs">
     160      <xsl:variable name="numDocsMatched" select="/page/pageResponse/metadataList/metadata[@name='numDocsMatched']"/>
     161      <xsl:variable name="numDocsReturned" select="/page/pageResponse/metadataList/metadata[@name='numDocsReturned']"/>
     162      <xsl:choose>
     163        <xsl:when test="$numDocsMatched='0' or $numDocsReturned='0'">
     164          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.nodocsmatch')"/>
     165        </xsl:when>
     166        <xsl:when test="$numDocsMatched='1' or $numDocsReturned='1'">
     167          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.onedocsmatch')"/>
     168        </xsl:when>
     169        <xsl:when test="$numDocsMatched">
     170          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.manydocsmatch', $numDocsMatched)"/>
     171          <xsl:if test="$numDocsReturned and not($numDocsMatched=$numDocsReturned)"> (<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.docsreturned', $numDocsReturned)"/>)</xsl:if>
     172        </xsl:when>
     173         <xsl:when test="$numDocsReturned">
     174          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.atleastdocsmatch', $numDocsReturned)"/>
     175        </xsl:when>
     176      </xsl:choose>
     177    </div>
     178
     179  </xsl:template>
    158180    <xsl:template name="displayTermInfo">
    159181        <!-- Find the total number of documents returned -->
     
    184206       
    185207        <!-- The list of search terms with their frequency and document count -->
    186         <xsl:choose>
    187             <xsl:when test="$docMax &gt; 0">
    188208                <p class="termList">
    189209                    <xsl:if test="count(/page/pageResponse/termList/stopword) &gt; 0">
    190210                        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.common')"/><xsl:text> </xsl:text>
    191                     </xsl:if>
    192                    
    193                     <xsl:if test="/page/pageResponse/termList/stopword">
    194211                        <xsl:for-each select="/page/pageResponse/termList/stopword">
    195212                            <span style="font-style:italic;"><xsl:value-of select="@name"/></span><xsl:text> </xsl:text>
     
    210227                                            <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.time')"/>
    211228                                        </xsl:when>
    212                                         <xsl:when test="@freq &lt; 0"></xsl:when>
    213                                         <xsl:when test="@freq &gt; 1">
     229                                        <xsl:otherwise>
    214230                                            <xsl:value-of select="@freq"/>
    215231                                            <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.time_plural')"/>
    216                                         </xsl:when>
     232                                        </xsl:otherwise>
    217233                                    </xsl:choose>
    218                                     <xsl:if test="not(not(@numDocsMatch) or @numDocsMatch = '')">
     234                                    <!--<xsl:if test="not(not(@numDocsMatch) or @numDocsMatch = '')">-->
     235                                                                         <xsl:if test="@numDocsMatch &gt; 0">
    219236                                        <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.in')"/><xsl:text> </xsl:text>
    220237                                        <xsl:value-of select="@numDocsMatch"/>
     
    253270                    </xsl:for-each>
    254271                </p>
    255             </xsl:when>
    256             <xsl:otherwise><!-- 0 results. Still need to check for search term being stopwords -->
    257               <xsl:choose>
    258                 <xsl:when test="count(/page/pageResponse/termList/stopword) &gt; 0">
    259                   <p class="termList">
    260                 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.common')"/><xsl:text> </xsl:text>
    261                
    262                 <xsl:if test="/page/pageResponse/termList/stopword">
    263                   <xsl:for-each select="/page/pageResponse/termList/stopword">
    264                     <span style="font-style:italic;"><xsl:value-of select="@name"/></span><xsl:text> </xsl:text>
    265                   </xsl:for-each>
    266                   <br /><br />
    267                 </xsl:if>
    268                   </p>           
    269                 </xsl:when>
    270                 <xsl:otherwise><!-- 0 results and not owing to stopwords.-->
    271                   <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.nodocsmatch')"/>
    272                 </xsl:otherwise>
    273               </xsl:choose>
    274             </xsl:otherwise>
    275         </xsl:choose>
    276272    </xsl:template>
    277273   
Note: See TracChangeset for help on using the changeset viewer.