Tech Blog

SRU External Search Program

  • The SRU External Search Program provides SRU, SRUP and SRW search functionality for MetaLib.
    Supports autoconfiguration using explain response from the server. Supported metadata schemas are MARCXML, UniMARC in XML, Dublin Core (including some qualified DC) and LuceneDocument.
  • License: MPL 1.1 / GPL 2.0
  • 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: MPL 1.1, GPL 2.0
  • Skill required for using this code: basic



Programming language


Software requirements

MetaLib 4.x

Author(s) homepage


Working example

Using the following Ex Libris open interfaces

Adapter interface


Version 2.6 – 11 Aug 2011

  • Initial release on CodeShare.
  • Fixed a lingering character encoding issue in search results.
  • Renamed files from srwu to sru to reflect that srw is not a separate thing (and has not been for a good while).

Version 2.5

  • Added support for LuceneDocument.
  • Fixed a UTF-8 problem, the script might have output ISO-8859-1 instead.
  • Added trimming of leading and trailing whitespace in fields.
  • Fixed processing of extraRecordData.

Version 2.4

  • Fixed startRecord in l_sru_present, it was one off.
  • Fixed character set in SRW requests in l_sru_present.

Version 2.3

  • Added support for schema identifiers in addition to the short names. Autoconfiguration will still use short names, but identifiers can be forced in the configuration.
  • Added support for oai_dc schema (handled as dc).

Release notes

The functionality is mature and has been used in Nelli Portal in Finland for many years. The SRU program has previously been available at (where are still some other external programs and some background information) but has now been moved to CodeShare to make it more discoverable.


  • Supports MARC-XML (also UNIMARC in XML) and Dublin Core record schemas
  • Supports limited autoconfiguration using the explain service
  • Supports manually configurable operating mode (SRU, SRUP (SRU POST) and SRW), record schema and search index mappings
  • Supports some qualified Dublin Core
  • Supports LuceneDocument

Installation instructions

  • Latest version is only tested on MetaLib 4.4. It probably works in previous versions too
  • Unpack the files to dat01/vir_ext (tar -xf …)
  • Make sure they are executable (chmod +x filename)
  • Check perl path in each file (the first line). Our MetaLib resides at m4_3, so you may need to change it to m4_3 or such
  • Make sure that l_sru_common resides in the same directory as the other files, otherwise it won’t be found by the programs
  • SRU mode is default
  • IRD: Hostname:Port: enter the full address of the SRU or SRW service (
  • IRD: Database Code: enter desired configuration options separated by a semicolon. See the beginning of l_sru_find program for information about the available options.NB: only 50 characters are relayed to the external programs. Use a configuration file if you need more options.
  • Conf: Find Module: l_sru_find
  • Conf: Present Module: l_sru_present
  • Conf: Outgoing character conversion: (leave empty)
  • Record Type: USMARC
  • Format conversion program: vir_z00_z39_usmarc
  • Incoming character conversion: (leave empty)
  • If using UNIMARC: Conversion program (Conversion tab): vir_fix_doc_unimarc

Download the code here.

Leave a Reply