Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

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.

  • PyPI version PyPI - Python Version PyPI - Django Version PyPI - License
  • Build status Code coverage Documentation Status CodeFactor Maintainability Requirements Status

Currently tested against Python 3.6 and 3.8, Solr 6.6.5 and 8.6.2, and Django 2.2-3.1 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.

Note

The SolrSchema must be imported somewhere for it to be found automatically.

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]'
    

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.

Files for parasolr, version 0.7.0
Filename, size File type Python version Upload date Hashes
Filename, size parasolr-0.7.0-py2.py3-none-any.whl (59.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size parasolr-0.7.0.tar.gz (49.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page