Changeset 30812


Ignore:
Timestamp:
09/15/16 13:49:25 (4 years ago)
Author:
kjdon
Message:

tidying up xxx occurs y times in z documents. dont need docs bits if there are 0 or 1 occurrences. put quotes around the term to make it easier to read the sentence. MG doesn't give numdocsmatch? so just display term freq for that, like solr.

Location:
main/trunk/greenstone3/web
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/WEB-INF/classes/interface_default.properties

    r30809 r30812  
    7171query.docsreturned={0-numdocs} {1-level-plural} returned.
    7272
    73 query.termoccurs.0={0-term} occurs 0 times
    74 query.termoccurs.1={0-term} occurs 1 time
    75 query.termoccurs.x={0-term} occurs {1-termfreq} times
    76 
    77 query.termoccurs.1.1={0-term} occurs 1 time in 1 {1-level-single}
    78 query.termoccurs.x.1={0-term} occurs {1-termfreq} times in 1 {2-level-single}
    79 query.termoccurs.x.x={0-term} occurs {1-termfreq} times in {2-numdocs} {3-level-plural}
    80 
    81 #query.termoccurs.1.1={0-term} occurs {1-termfreq} time
    82 #query.termoccurs.x.1={0-term} occurs {1-termfreq} times
    83 #query.termoccurs.x.x={0-term} occurs {1-termfreq} times
    84 #query.termSectionFreq=in {0-numdocs} {1-level-plural}
     73query.termoccurs.0='{0-term}' occurs 0 times
     74query.termoccurs.1='{0-term}' occurs 1 time
     75query.termoccurs.x='{0-term}' occurs {1-termfreq} times
     76
     77query.termoccurs.x.1='{0-term}' occurs {1-termfreq} times in 1 {3-level-single}
     78query.termoccurs.x.x='{0-term}' occurs {1-termfreq} times in {2-numdocs} {3-level-plural}
     79
    8580query.document=document
    8681query.document_plural=documents
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/query.xsl

    r30803 r30812  
    318318            <!-- If there is only one or two search terms then show the expanded information -->
    319319            <xsl:choose>
    320                           <xsl:when test="count(/page/pageResponse/termList/term) &lt; 3">
     320              <xsl:when test="count(/page/pageResponse/termList/term) &lt; 3">
    321321               
    322                         <xsl:variable name="qtOneToOne"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.1.1')"/></xsl:variable>
    323                     <xsl:variable name="qtManyToOne"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x.1')"/></xsl:variable>
    324                     <xsl:variable name="qtManyToMany"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x.x')"/></xsl:variable>
    325 
    326                     <xsl:for-each select="/page/pageResponse/termList/term">
    327 
    328 
    329                             <xsl:variable name="occursTextValue">
    330                             <xsl:choose>
    331                                 <xsl:when test="@freq = 1"><xsl:value-of select="$qtOneToOne"/></xsl:when>
    332                                 <xsl:when test="@numDocsMatch = 1"><xsl:value-of select="$qtManyToOne"/></xsl:when>
    333                                 <xsl:otherwise><xsl:value-of select="$qtManyToMany"/></xsl:otherwise>
    334                             </xsl:choose>
    335                         </xsl:variable>
    336                         <xsl:variable name="levelText">
    337                             <xsl:call-template name="documentLevelText">
    338                                 <xsl:with-param name="level" select="$level"/>
    339                                 <xsl:with-param name="numDocsMatched" select="@numDocsMatch"/>
    340                             </xsl:call-template>
    341                         </xsl:variable>
    342                         <span class="termInfo">
    343                           <!-- For solr collections, display:
    344                                  term x occured y times
    345                                  term a occured b times
    346                                For collections using all other indexers, display:
    347                                  term x occurred y times in n sections/documents
    348                                  term a occurred b times in m sections/docs
    349                           -->
    350                           <xsl:variable name="gitArg1" select="concat(@name,';', @freq)"/>
    351 
    352                             <xsl:choose>
    353                               <xsl:when test="@freq = 1">
    354                                 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.1.1',$gitArg1)"/>
    355                               </xsl:when>
    356                               <xsl:when test="@numDocsMatch = 1">
    357                                 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x.1',$gitArg1)"/>
    358                               </xsl:when>
    359                               <xsl:otherwise>
    360                                 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x.x',$gitArg1)"/>
    361                               </xsl:otherwise>
    362                             </xsl:choose>
    363                            
    364                             <!--
    365                                 <xsl:value-of select="java:org.greenstone.gsdl3.util.XSLTUtil.getInterfaceTextSubstituteArgs($gitArgXXX,$gitArg1)"/>
    366 -->
    367                              
    368 <!--                         
    369     <xsl:value-of select="java:org.greenstone.gsdl3.util.XSLTUtil.getInterfaceTextSubstituteArgs($occursTextValue,$gitArg1)"/>
    370     -->
    371                              
     322                <xsl:for-each select="/page/pageResponse/termList/term">
     323                  <xsl:variable name="levelText">
     324                <!-- this gets document, section, documents, sections, depending on level and number -->
     325                <xsl:call-template name="documentLevelText">
     326                  <xsl:with-param name="level" select="$level"/>
     327                  <xsl:with-param name="numDocsMatched" select="@numDocsMatch"/>
     328                </xsl:call-template>
     329                  </xsl:variable>
     330                  <span class="termInfo">
    372331                         
    373                             <xsl:choose>
    374                               <xsl:when test="/page/pageResponse/collection[@type != 'solr']">
    375                                 <xsl:variable name="gitArg2" select="concat(@numDocsMatch,';',  $levelText)"/>
    376                                 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termSectionFreq', $gitArg2)"/>
    377                               </xsl:when>
    378                             </xsl:choose>
    379                         </span>
    380                         <br/>
    381                     </xsl:for-each>
    382                 </xsl:when>
    383                 <xsl:otherwise>
     332                <!-- For solr and mg collections, display:
     333                     term x occured y times
     334                     term a occured b times
     335                     For collections using all other indexers, display:
     336                     term x occurred y times in n sections/documents
     337                     term a occurred b times in m sections/docs
     338                -->
     339                <!-- not all these args are used in every case -->
     340                <xsl:variable name="args" select="concat(@name,';', @freq, ';', @numDocsMatch,';',  $levelText)"/>
     341                <xsl:choose>
     342                  <xsl:when test="@freq = 0">
     343                    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.0',$args)"/>
     344                  </xsl:when>
     345                  <xsl:when test="@freq = 1">
     346                    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.1',$args)"/>
     347                  </xsl:when>
     348                  <xsl:otherwise> <!-- more than one occurrance -->
     349                    <xsl:choose>
     350                      <xsl:when test="/page/pageResponse/collection[@type = 'solr'] or /page/pageResponse/collection[@type = 'mg']">
     351                    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x',$args)"/>
     352                      </xsl:when>
     353                      <xsl:when test="@numDocsMatch = 1">
     354                    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x.1',$args)"/>
     355                      </xsl:when>
     356                      <xsl:otherwise>
     357                    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x.x',$args)"/>
     358                      </xsl:otherwise>
     359                    </xsl:choose>
     360                  </xsl:otherwise>
     361                </xsl:choose>
     362               
     363                  </span>
     364                  <br/>
     365                </xsl:for-each>
     366              </xsl:when>
     367              <xsl:otherwise>
    384368                    <xsl:for-each select="/page/pageResponse/termList/term">
    385369                        <span style="font-style:italic;">
Note: See TracChangeset for help on using the changeset viewer.