Metadata-Version: 2.4
Name: vupysolr
Version: 0.3.0
Summary: Access Solr stored VuFind records.
Home-page: https://github.com/herreio/vupysolr
Author: Donatus Herre
Author-email: donatus.herre@slub-dresden.de
License: GPLv3
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: pysolr
Requires-Dist: pymarc
Requires-Dist: python-dateutil
Requires-Dist: requests
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

========
vupysolr
========

``vupysolr`` allows to access Solr stored VuFind records. For more information on
VuFind, see https://vufind.org.

Installation
============

.. code-block:: bash

   pip install vupysolr

Usage Examples
==============

Command Line
~~~~~~~~~~~~

::

    $ vupysolr --id 123456789


::

    usage: vupysolr [-h] [--url URL] [--core CORE] [--id ID] [--marc [MARC]]
                    [--decode [DECODE]] [--pretty [PRETTY]] [--search [SEARCH]]

    optional arguments:
      -h, --help         show this help message and exit
      --url URL          URL of VuFind Solr server (default:
                         http://localhost:8983/solr)
      --core CORE        Name of VuFind Solr core (default: biblio)
      --id ID            ID of record to fetch (default: None)
      --marc [MARC]      Get MARC data only (default: False)
      --decode [DECODE]  Decode MARC data (default: False)
      --pretty [PRETTY]  Pretty print output (default: False)
      --search [SEARCH]  Fetch record via search instead of real-time get
                         (default: False)


Interpreter
~~~~~~~~~~~

.. code-block:: python

    import vupysolr


*Create VuFind Solr index client*

.. code-block:: python

    url = "https://vufind.example.com/solr"
    core = "collection"
    index = vupysolr.index(url, core=core, marc=True)


*Retrieve VuFind Solr document from index*

.. code-block:: python

    doc_id = "123456789"
    doc = index.get(doc_id)


*Retrieve multiple VuFind Solr documents from index*

.. code-block:: python

    doc_ids = ["123456789", "987654321"]
    docs = index.get_many(doc_ids)
    # dictionary of documents by id, missing ids are omitted
    doc = docs.get("123456789")


Documents are fetched via the real-time get handler (``/get``) of Solr. To
fetch them via search (``/select``) instead, create the client with
``realtime=False``.

.. code-block:: python

    index = vupysolr.index(url, core=core, marc=True, realtime=False)


*Inspect fields of VuFind Solr document*

.. code-block:: python

    # print document title
    print(doc.title)
    # print timestamp of last indexation
    print(doc.last_indexed)
    # print timestamp of latest transaction (MARC)
    print(doc.marc_latest_transaction)
