Skip to main content

A wrapper for pySolr

Project description

Install

pip install -r requirements.txt
pip install .

Tests

python -m pytest

PEP

pep8

Usage

from pysolrwrapper.core import SolrQuery
from pysolrwrapper.filter import (FilterText, FilterColumnEnum)

    result = SolrQuery("localhost:9983", "omop-concept")\
        .set_type_edismax()\
        .select(["concept_id","concept_name"])\
        .add_filter(FilterText(["disease lethal", "patient"]))\
        .add_filter(FilterColumnEnum("standard_concept", ["c","s"]))\
        .add_filter(FilterColumnEnum("standard_concept", ["*"]))\
        .highlight(["concept_name", "synonym_concept_name"])\
        .facet(-1, ["standard_concept", "domain_id"])\
        .sort("score", "asc")\
        .sort("concept_id", "asc")\
        .limit(2)\
	.run()

Results

Depending on what you ask for, the result is a dictionnary with this format:

{'num_shown': 2,
 'num_found': 7052,
 'docs': [{'concept_id': '42742376',
           'concept_name': 'Molecular pathology procedure, Level 7'},
          {'concept_id': '2107646',
           'concept_name': 'Direct repair of aneurysm, pseudoaneurysm, or excision(partial or total) and graft insertion, with or without patch graft for ruptured aneurysm, abdominal aorta involving iliac vessels(common, hypogastric, external)'}],
    'facet_fields': {'standard_concept': [{'s': 6263},
                                          {'c': 789}],
                     'domain_id': [{'condition': 2870},
                                   {'measurement': 1621},
                                   {'observation': 1481},
                                   {'drug': 659},
                                   {'procedure': 303},
                                   {'meas': 100},
                                   {'value': 100},
                                   {'provider': 13},
                                   {'specialty': 13},
                                   {'device': 3}]
                     }
 }

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 pysolrwrapper, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pysolrwrapper-1.0.0-py3.6.egg (9.5 kB) File type Egg Python version 3.6 Upload date Hashes View

Supported by

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