Metadata-Version: 2.1
Name: slubfind
Version: 1.2.0
Summary: query data exports from the SLUB catalog
Author: Donatus Herre
Author-email: donatus.herre@slub-dresden.de
License: GPLv3
Project-URL: homepage, https://github.com/slub/slubfind
Project-URL: repository, https://github.com/slub/slubfind
Project-URL: issues, https://github.com/slub/slubfind/issues
Project-URL: changelog, https://github.com/slub/slubfind/blob/main/CHANGELOG
Keywords: slub,solr,typo3-find
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: txpyfind>=1.1.0

========
slubfind
========

With ``slubfind`` you can query data exports from the `SLUB catalog <https://katalog.slub-dresden.de>`_
in Python.

This package is based on `txpyfind <https://github.com/slub/txpyfind>`_,
which enables access to data exports from `TYPO3-find <https://github.com/subugoe/typo3-find>`_.

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

... via PyPI
~~~~~~~~~~~~

.. code-block:: bash

   pip install slubfind

... or from Github source
~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash

   pip install git+https://github.com/slub/slubfind.git


Command-Line Usage
==================

After installation, the ``slubfind`` command is available (also via ``python -m slubfind``).
The base URL defaults to ``https://katalog.slub-dresden.de``.

Query
~~~~~

Execute a search query in app format:

.. code-block:: bash

   slubfind query "manfred bonitz"

With a facet filter and pagination:

.. code-block:: bash

   slubfind query "python" --facet "format_de14=Book, E-Book" --page 1 --count 10

Document
~~~~~~~~

Fetch a single document by ID in app format:

.. code-block:: bash

   slubfind document "0-1132486122"

Scroll
~~~~~~

Fetch all results for a query:

.. code-block:: bash

   slubfind scroll "manfred bonitz" --batch 10

Stream results as JSONL (one JSON object per line), useful for piping:

.. code-block:: bash

   slubfind scroll "manfred bonitz" --stream | jq .id

Settings
~~~~~~~~

Show TYPO3-find settings:

.. code-block:: bash

   slubfind settings

Solr Parameters
~~~~~~~~~~~~~~~

Show Solr parameters for a query:

.. code-block:: bash

   slubfind solr-params "manfred bonitz"

Solr Request
~~~~~~~~~~~~

Show Solr request URL for a query:

.. code-block:: bash

   slubfind solr-request "manfred bonitz"

Show Request URL
~~~~~~~~~~~~~~~~

Use ``--show-url`` to print the request URL instead of fetching the response.
This works with all subcommands:

.. code-block:: bash

   slubfind --show-url query "python" --facet "format_de14=Book, E-Book"
   slubfind --show-url document "0-1132486122"
   slubfind --show-url scroll "python" --batch 10

Environment Variable
~~~~~~~~~~~~~~~~~~~~

Set ``SLUBFIND_URL`` to override the default base URL:

.. code-block:: bash

   export SLUBFIND_URL=https://katalog.slub-dresden.de
   slubfind query "manfred bonitz"

Python Usage Example
====================

.. code-block:: python

   from slubfind.client import SlubFind
   # create SlubFind instance
   slub_find = SlubFind()
   # retrieve JSON data (query view, app format)
   slub_q = slub_find.app_search("manfred bonitz")
   # retrieve JSON data (detail view, app format)
   slub_doc = slub_find.app_document("0-1132486122")
