Protocol Operations

The need to conform to web-based communication has shaped the specification. Querying an SRU server involves the same considerations as submitting any web-based form. In its simplest form, a connection URL for an SRU service looks like http://hostname/database?version=versionNumber&operation=operation. The use of the database as part of the URL allows access to multiple databases or record sets, depending on the configuration of the SRU server. In the current version of the protocol, version and operation are both required. Different operations may require additional parameters, for example a query parameter for searchRetrieve operations.

The heart of the SRU searchRetrieve operation is the Contextual Query Language (CQL), which is discussed in detail in the Related Standards section.

Because the results of all operations are valid XML, web applications can make direct use of the data. An example of this is the OCLC Open SiteSearch Documentation site. The search interface is built using the XML results of the explain operation using XSL. Results of searches are likewise displayed using XSL.

Operations

There are three basic operations in SRU:

By comparison, the Z39.50 specification lists nine different operation types, many of which are poorly supported by software implementations.

Additional Parameters

In addition to the version and operation parameters, the specification defines additional request, response, record and result set parameters specific to each operation. The response, record or term, and result set parameters are returned as part of an XML structure in keeping with the use of XML for data exchange.

Request Parameters

As mentioned above, the searchRetrieve operation uses requires a query parameter. The scan operation requires a scanClause parameter. The number of available request parameters varies - explain has three optional, scan has one mandatory and four optional, and searchRetrieve has one mandatory and seven optional parameters in version 1.2. These additional parameters control various features of the records returned, such as record schema, number of records and position in the result set. For example, an SRU search http://z3950.loc.gov:7090/voyager?version=1.1&query=%22tai%20chi%22&maximumRecords=5&operation=searchRetrieve would search (operation=searchRetrieve) the Library of Congress (http://z3950.loc.gov:7090/voyager) for items in the default index containing the term "tai chi" (query="tai chi") and return at most five records (maximumRecords=5).

Response Parameters

The response, record or term, and result set parameters are provided as part of the XML document returned from an operation request. Many parameters are specific to the type of operation requested. For example, the explain operation does not return search results, so it has no record or result set parameters. The scan operation returns a list of terms, not records. This parallels the structural differences in the request parameters.

Previous: History and Literature Review Next: Software Applications