Tech Blog

Composer Prolific Author Title Search in Tomcat

  • DescriptionUses the AUTH or OPAC Name/Title Headings Search with the keyword modifier AUTH@ and the searchBasic.js file, the webvoyage.properties file, and the display.xsl file.
    Composer/Author Title (keyword) finds records using a composer or author’s last name and keywords from a title. Best used to find works by a prolific composer or author. It is recommended to use a question mark ‘?’ to truncate words; for example, try searching for symphon? instead of symphony or symphonies to retrieve the best results.
  • Author: Ken Herold
  • Additional author(s):
  • Institution: Hamilton College
  • Year: 2012
  • License: BSD style
  • Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
  • Link to terms: Detailed license terms
  • Skill required for using this code:
    Advanced.

State

Stable

Programming language

Javascript for the tips description and XSLT 1.0 for the templates.

Software requirements

Voyager 7+

Working example

mozart nachtmusik

http://lib.hamilton.edu/vwebv/search?searchArg=mozart+nachtmusik&searchCode=AUTH%40&searchType=1&page.search.search.button=Search&recCount=50

Installation instructions

Text…

In the display.xsl file, following the buildTitle template, insert:
<!– ################## Composer Title template ##### Ken Herold ################## –>
<xsl:template name="buildRedir700" match="displayTag">
      
      <xsl:for-each select="displayTag">
          <xsl:variable name="countText" select="position()"></xsl:variable>
        <xsl:if test="$countText=1">
          <xsl:variable name="redirectsearchStart">search?searchArg1=</xsl:variable>
          <xsl:variable name="redirectSearchCode">&amp;searchCode1=</xsl:variable>
          <xsl:variable name="redirectSearchFinish">&amp;searchType=2</xsl:variable>
          <xsl:variable name="displayTag" select="."/>
          <xsl:variable name="altText">specific 700 search code</xsl:variable>
          <xsl:variable name="field" select="'700'"/>
          <xsl:variable name="subfield" select="@subfield"/>
          <xsl:variable name="newSearchCode">AUTH@</xsl:variable>
          
         <xsl:for-each select="$bibRecord/hol:marcRecord/slim:datafield[@tag='700']">
              <xsl:variable name="indic2" select="@ind2"/>
              
              <xsl:variable name="subfieldData">
                  <xsl:call-template name="BMDDisplaySubfield">
                      <xsl:with-param name="subfield" select="$subfield"/>
                      <xsl:with-param name="displayTag" select="$displayTag"/>
                  </xsl:call-template>
              </xsl:variable>
             
              <xsl:if test="string-length($subfieldData)">
                  <xsl:choose>
                      <xsl:when test="$indic2='2'">
                          <a href="{$redirectsearchStart}{$subfieldData}{$redirectSearchCode}AUTH@{$redirectSearchFinish}" alt="{$altText}" title="{$altText}">
                              <xsl:value-of select="$subfieldData"/>
                          </a><br />
                      </xsl:when>
                      <xsl:otherwise>
                          <a href="{$redirectsearchStart}{$subfieldData}{$redirectSearchCode}NAME{$redirectSearchFinish}" alt="{$altText}" title="{$altText}">
                              <xsl:value-of select="$subfieldData"/>
                          </a><br />
                      </xsl:otherwise>
                  </xsl:choose>
        </xsl:if>                       
        
         </xsl:for-each>
            </xsl:if>
       </xsl:for-each>
      
  </xsl:template>
<!– ###################################################################### –>

 

and make this the first when statement in the choose section of the following outputDisplayData template:

 

<!– XXXXXXXXXXXXXXXXXXXXXXXXXXXXX Composer Title added XXXXXXXXXXXXXXXXXXXXXXXXXXXX –>
<xsl:when test="string-length($displayData) and displayTag/@field='700'">
            
                <xsl:variable name="redirect700">
                    <xsl:call-template name="buildRedir700"/>
                </xsl:variable>
                
               
                    <span class="fieldLabelSpan">
                        <xsl:choose>
                            <xsl:when test="string-length(@label)">
                                <xsl:value-of select="@label"/>
                            </xsl:when>
                            <xsl:otherwise>
                                &#160;
                            </xsl:otherwise>
                        </xsl:choose>
                    </span>
         
                    <span class="subfieldData">
                    <xsl:copy-of select="$redirect700"/>
                    </span>
               
            
           </xsl:when>

<!– XXXXXXXXXXXXXXXXXXX end XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX –>

TO DO list

Enter your tips in searchBasic.js

case ‘AUTH@’:
document.getElementById(‘customSearchTip’).innerHTML =
“<p><strong>Composer/Author Title (keyword)</strong> finds records using a composer or author’s last name and keywords from a title. Best used to find works by a prolific composer or author. It is recommended to use a question mark to truncate words; for example, try searching for symphon? instead of symphony or symphonies to retrieve the best results.</p><ul><li>Mozart nachtmusik</li><li>Beethoven sonat?</li><li>Mozart night music</li><li>Bruckner symphon?</li><li>Shakespeare juliet</li></ul>”+tips;

Comments

This goes in webvoyage.properties:

page.search.basic.search.code.nameTitle=
page.search.basic.search.code.nameTitle.code=AUTH@
page.search.basic.search.code.nameTitle.order=15
page.search.basic.search.code.nameTitle.display=Composer/Author Title (keyword)

Leave a Reply