Selectable Sorting of Keyword Search Results

In Webpac, you can sort the results of keyword searches using any available information in the MARC record, such as Title, Author, Publication Date, etc. You can even sort the results using a combination of information from different parts of the MARC record, such as first by author in alphabetical order and then by latest date of publication.

As mentioned in the online article on Default Sorting, the connection between the MARC records in the Horizon database and WebPAC sorting, is made in the Zserver Sort File where MARC Map codes are linked to Z39.50 Use attributes.

In order to sort keyword search results, based on a patron's choice of sort order, you need to update

STEP 1.
To determine the Bib List View included in the PAC Flavor used by WebPAC, you first need to select the "PAC Flavor Table (Flavor)" option listed on the PAC Control Menu (PacCtl) within the Horizon Menu Manager, to display the list of Public Access "Flavors" in the Horizon Table Editor.

STEP 2.
Highlight the PAC Flavor used by WebPAC and click "Edit" to display the current field values.

STEP 3.
Note the name of the Horizon View assigned to the Bib List View field (usually "biblist"), then click "Close" to close the WebPAC PAC Flavor, and then close the view listing the PAC Flavors.

Now that you know the Bib List View included in the PAC Flavor used by WebPAC, you can look up the MARC Map codes that you need for sorting.

STEP 4.
In the Horizon Table Editor, open the Horizon View Definitions (mq_view).

STEP 5.
Enter the name of the Horizon View specified in the Bib List View field of the PAC Flavor table used by WebPAC, then click "OK".

STEP 6.
Click "Edit" to display the current field values for the single Horizon View listed, then page down to page 3 where the marc_map field should be visible within the List View blink (box).

STEP 7.
Click the "Codes" button for the marc_map field to perform a code lookup on the list of available marc_map codes; noting the names of the case-sensitive codes that map the MARC information necessary for the different types of sorted results. Usually this involves at least looking up the MARC Map codes that can be used to sort by Title, Author, and Date of Publication.

STEP 8.
Once you know the codes you need for all your selectable sorting choices, click "Cancel" then scroll through the list of List View options to make sure that the MARC Map codes you need are all referenced.

If you cannot find the MARC Map code you need or you find that a code is not referenced, you can refer to the WebPAC MARC Mapped Information Filtering online article for further information on creating a new MARC Map code and adding a MARC Map code to a List View.


STEP 9.
Create or modify the Sort file used by the Z39.50 Server program (Zdaemon) to include the case-sensitive MARC Map codes and unused Use attribute numbers (such as the numbers 5500-8500) for each type of sort that will be available for selection.

The Sort file (normally named "sort.txt"), a text file referenced by the "/S (capital S)" argument to the Zserver program "zdaemon.exe" or "zdaemon", should be located in the Zserver directory.

This file is organized in separate sections, each section being optional.

  • The first line specifies the maximum resultset size (maxrset) past which the result set will not be sorted at all. This gives you some control over the performance impact of sorting.

  • In the [Sort] section, you can link Use attributes assigned to searches in the Horizon Search Table to MARC Map codes identifying the information for default sorting, and you can also link unused Use attribute numbers to MARC Map codes identifying the information to use in patron selectable sorting. Each comma-separated code should be followed by a colon (:) and an A for ascending or a D for descending sort order, and assigning more than two codes to a Use attribute may cause problems.

  • In the [Restrict] section, unused Use attribute numbers link to MARC Map codes for filtering.

In the above example, we have defined eight sort criteria for patron selectable sorting:

  • Title A-Z (ascending)
  • Title Z-A (descending)
  • Author A-Z (ascending)
  • Author Z-A (descending)
  • Oldest Publication Date
  • Newest Publication Date
  • Ascending Titles within given Ascending Authors
  • Ascending Publication Dates within given Ascending Authors

STEP 10.
Save your changes to the Sort file and then re-start the Zserver.

You can now proceed with the modifications to the WebPAC Connection CFM file and HTML Search Template file.


STEP 11.
Add the Sort Selection Use attribute (9990) to the Connection CFM file used by WebPAC.

 WebPAC 1.2, Connection CFM, Search Types Section
  # Name Qualifier Category Use Structure Truncation Relation Position Completeness Scannable Normalize  
  Zsort, ZS, 0, 9990, 2, 100, 0, 0, 0, 0, 1,  

 WebPAC 1.3, Connection CFM, SearchAttributes Section
  // Name Qualifier View Category Scannable Normalize Attribute Set ID   Use Structure Truncation      
  [Zsort, ZS, BRIEF, 0, 0, 1, BIB1,  [  [1,9990,] [4,2,] [5,100,]] ]
Note that in WebPAC 1.3 the Z39.50 attribute type/value pairs, surrounded by square brackets, are usually placed on a separate line, and the closing bracket on a third.

STEP 12.
Modify the HTML Search Template file to include the case-sensitive Zserver Sort Selection Qualifier code you added to the Connection CFM file, and the Use attributes you added to the Zserver Sort File defining the sort criteria you wish to use.

This usually involves adding a select list or drop box option containing sort options to the template file. For example,

     WebPAC 1.2, Search Template
    <font size="-1">Sort Keyword Search by:</font><br>
    <select name="SORTBY">
        <option value="">None
        <option value=" and 6001.ZS.">Title A-Z (ascending)
        <option value=" and 6002.ZS.">Title Z-A (descending)
        <option value=" and 6003.ZS.">Author A-Z (ascending)
        <option value=" and 6004.ZS.">Author Z-A (descending)
        <option value=" and 6005.ZS.">Earliest Date of Publication
        <option value=" and 6006.ZS.">Latest Date of Publication
        <option value=" and 6007.ZS.">Author, then Title
        <option value=" and 6008.ZS.">Author, then Publication Date
    </select>

     WebPAC 1.3, Search Template
    <font size="-1">Sort Keyword Search by:</font><br>
    <select name="SORTBY">
        <option value="">None
        <option value=" and ZS 6001">Title A-Z (ascending)
        <option value=" and ZS 6002">Title Z-A (descending)
        <option value=" and ZS 6003">Author A-Z (ascending)
        <option value=" and ZS 6004">Author Z-A (descending)
        <option value=" and ZS 6005">Earliest Date of Publication
        <option value=" and ZS 6006">Latest Date of Publication
        <option value=" and ZS 6007">Author, then Title
        <option value=" and ZS 6008">Author, then Publication Date
    </select>

STEP 13.
If necessary, modify all occurances of the value of the Search Query Command HTML Tag (the tags having the name "SCMD") within the HTML Search Template file, to include the name of the HTML Select Tag, formatted as $${tagname}, containing the sort order options. For example,

    <input type="Hidden" name="SCMD"
      value="${RUNKEY} ${SESSIONKEY} $${QUERY} $${INPUT} $${SORTBY}">

 


Copyright © 1999-2000 epixtech, inc. All rights reserved.
Please email any comments, questions & suggestions to p.roberts@epixtech.com