Skip to main content

Lightweight python library for Solr indexing, searching and schema management with optional Django integration.

Project description

parasolr is a lightweight python library for Apache Solr indexing, searching and schema management with optional Django integration. It includes a Solr client (parasolr.solr.SolrClient). When used with Django, it provides management commands for updating your Solr schema configuration and indexing content.

Tested against Python 3.9-3.11, Solr 8.6 and 9.2, and Django 3.2-4.0 and without Django.

Installation

Install released version from pypi:

pip install parasolr

To install an unreleased version from GitHub:

pip install git+https://github.com/Princeton-CDH/parasolr@develop#egg=parasolr

To use with Django:

  • Add parasolr to INSTALLED_APPS

  • Configure SOLR_CONNECTIONS in your django settings:

    SOLR_CONNECTIONS = {
        'default': {
        'URL': 'http://localhost:8983/solr/',
        'COLLECTION': 'name',
        # Any configSet in SOLR_ROOT/server/solr/configsets.
        #   The default configset name is "_default" as of Solr 7.
        #   For Solr 6, "basic_configs" is the default.
        'CONFIGSET': '_default'
        }
    }
  • Define a SolrSchema with fields and field types for your project.

  • Run solr_schema manage command to configure your schema; it will prompt to create the Solr core if it does not exist.

Development instructions

This git repository uses git flow branching conventions.

Initial setup and installation:

  • Recommmended: create and activate a Python 3.6 virtualenv:

    python3 -m venv parasolr
    source parasolr/bin/activate
  • Install the package with its dependencies as well as development dependencies:

    pip install -e .
    pip install -e '.[dev]'

Install pre-commit hooks

Install configured pre-commit hooks (currently black and isort):

pre-commit install

Styling was instituted in version 0.8; as a result, git blame may not reflect the true author of a given line. In order to see a more accurate git blame execute the following command:

git blame <FILE> –ignore-revs-file .git-blame-ignore-revs

Or configure your git to always ignore the black revision commit:

git config blame.ignoreRevsFile .git-blame-ignore-revs

Unit testing

Unit tests are written with pytest but use some Django test classes for compatibility with Django test suites. Running the tests requires a minimal settings file for Django-required configurations.

  • Copy sample test settings and add a secret key:

    cp ci/testsettings.py testsettings.py
    python -c "import uuid; print('\nSECRET_KEY = \'%s\'' % uuid.uuid4())" >> testsettings.py
  • By default, parasolr expects Solr 8. If running tests with an earlier version of Solr, either explicitly change MAJOR_SOLR_VERSION in your local testsettings.py or set the environment variable:

    export SOLR_VERSION=x.x.x
  • To run the test, either use the configured setup.py test command:

    python setup.py test
  • Or install test requirements in and use pytest directly:

    pip install -e '.[test]'
    pytest

License

parasolr is distributed under the Apache 2.0 License.

©2019 Trustees of Princeton University. Permission granted via Princeton Docket #20-3619 for distribution online under a standard Open Source license. Ownership rights transferred to Rebecca Koeser provided software is distributed online via open source.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parasolr-0.9.1.tar.gz (51.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parasolr-0.9.1-py2.py3-none-any.whl (62.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file parasolr-0.9.1.tar.gz.

File metadata

  • Download URL: parasolr-0.9.1.tar.gz
  • Upload date:
  • Size: 51.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for parasolr-0.9.1.tar.gz
Algorithm Hash digest
SHA256 02a8f589ffc6d3ca5b75ea04e996f8fdeedf3dccbc99c3225fe767c8236db618
MD5 efe1de2547f5ac2f4f1f10757b7deb5c
BLAKE2b-256 2f3dc03eaa554f54227c9b0915d37667bdd459120b13a6474b8d62e498abb7f0

See more details on using hashes here.

File details

Details for the file parasolr-0.9.1-py2.py3-none-any.whl.

File metadata

  • Download URL: parasolr-0.9.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 62.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for parasolr-0.9.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 592290298a0ef9dcbb3bf9c3a34fd1d4ff288685013bb6481b1c0e72f121056a
MD5 697adcd3df35dd1239518ac5d5f62724
BLAKE2b-256 01147ce024b3e0e7222d4fa21031f01b31643f3f3eba10764e0ba527e8f62f84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page