Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
ruby client for the Search/Retrieval by URL protocol
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
test
.gitignore
.travis.yml
Changes
Gemfile
Gemfile.lock
README.md
Rakefile
sru.gemspec

README.md

sru

Build Status

sru is a Ruby library for talking to servers that support the Search & Retrieve by URL (SRU) protocol. SRU is a lightweight API for performing information retrieval over HTTP. It is lightweight compared to its pre-HTTP ancestor Z39.50. If you are thinking about implementing SRU on the server side you should probably be looking at the much more simple and widely deployed OpenSearch.

Typically SRU clients perform a 'searchRetrieve' operation on a repository and get back different flavored XML metadata for the hits. In addition SRU clients can perform an 'explain' operation which asks the SRU server to describe itself, and its capabilities. The final operation is 'scan' which allows a client to walk an index of terms used in the target.

Usage

require 'sru'

# create the client using a base address for the SRU service
client = SRU::Client.new 'http://sru.example.com'

# fetch a SRU::ExplainResponse object from the server
explain = client.explain

# issue a search and get back a SRU::SearchRetrieveResponse object 
# which serves as an iterator 
records = client.search_retrieve 'rosetta stone', {:maximumRecords => 5}
records.each {|record| puts record}

# issue a scan request and print out each term
client.scan('king tut', {:maximumTerms => 12}).each {|term| puts term}

Installation

You should be able to install the gem:

gem install sru

More information about the project:

http://github.com/edsu/sru-ruby

License

cc0

Something went wrong with that request. Please try again.