Skip to content

A project to solve the pesky problem of pulling MARC records from your Solr index

License

Notifications You must be signed in to change notification settings

uchicago-library/extract_marc_from_vufind

Repository files navigation

marcExtraction

This is a Python library that allows a consumer to extract MARC records from

  1. a file exported to disk
  2. a VuFind API

Quick start

  1. git cone git@github.com:uchicago-library/extract_marc_from_vufind
  2. cd extract_marc_from_vufind
  3. python -m venv venv
  4. source venv/bin/activate
  5. pip install -r requirements.txt
  6. python setup.py develop

And you are ready to start hacking new functionality to the code base. Don't forget to follow good branching and open source citizen etiquette when you're doing it though!

How to Use the Library

If you are looking to find some particular subset of a bunch of MARC records that you have on-disk, you can do something like the following.

>>> from marcextraction.interfaces import OnDiskSearcher
>>> searcher = OnDiskSearcher(location='/path/to/a/bunch/of/marc/record/files')
>>> results = searcher.search('banana', '245', ['a'])

This example will do the following

  1. Instantiate an instance of OnDiskSearcher with a list of valid MARC records at /path/to/a/bunch/of/marc/record/files
  2. Perform a search on the MARC records for any record with banana in MARC field '245', subfield 'a'.

Still, you might be in an organization using OLE. In which case, you could do something like this.

>>> from marcextraction.interfaces import SolrIndexSearcher
>>> searcher = SolrIndexSearcher('http://your.domain/path/to/index', 'ole', 'ole')
>>> results = searcher.search('banana', '245', ['a'], rows=100)

This example does the same thing as the earlier example except this time it's searching a SOLR index.

If you want to extract a particular MARC record from OLE, do the following:

>>> from marcextraction.interfaces import OLERecordFinder
>>> getter = OLERecordFinder(100134, 'domain.of.ole.sru.app', 'http', '/path/to/app'
>>> getter.get_record()

Internal Project Management

Additional Links

Author

About

A project to solve the pesky problem of pulling MARC records from your Solr index

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages