Name

sort — Metaproxy Z39.50 Sort Module

DESCRIPTION

This filter performs sorting of Z39.50 result sets. The sorting criteria is selected via an X-Path expression. Only XML records are supported. The sorting is done only for the first present request following a search. The number of records to prefetch is configurable. For example, if a client asks initially for 10 records this module may extend that, and fetch more records and only return the results in the 10 record window - after sorting.

The configuration is given as attribute inside element sort. This element must occur exactly once. Future versions of the sort module may include multiple sort elements. The attributes within sort are:

xpath

Specifies the X-Path expression that picks the sorting data from the record.

namespaces

Allows one or more namespaces to be declared with a user-defined prefix. Each prefix may be referred to within the xpath expression.

prefetch

Number of records to prefetch.

ascending

Is a boolean value (false, true). If true, the sort module will sort ascending. If false, the sort module will sort descending. If omitted, the sort order will be ascending.

SCHEMA

# Metaproxy XML config file schemas
#
#   Copyright (C) Index Data
#   See the LICENSE file for details.

namespace mp = "http://indexdata.com/metaproxy"

filter_sort =
  attribute type { "sort" },
  attribute id { xsd:NCName }?,
  attribute name { xsd:NCName }?,
  element mp:sort {
    attribute prefetch { xsd:integer }?,
    attribute xpath { xsd:string },
    attribute namespaces { xsd:string }?,
    attribute ascending { xsd:boolean }?,
    attribute debug { xsd:boolean }?
  }

   

EXAMPLES

For example, to sort MARCXML records on title, one could use:

<filter type="sort">
  <sort
    xpath="/marc:record/marc:datafield[@tag='245']/marc:subfield[@code='a']"
    namespaces="marc=http://www.loc.gov/MARC21/slim"
    prefetch="5"
    ascending="true"
    debug="true"
   />
</filter>

   

SEE ALSO

metaproxy(1)

record_transform(3mp)

COPYRIGHT

Copyright (C) 2005-2017 Index Data