Skip to main content

Minimalistic interface to Solr.

Project description

This is a very simple Solr interface for Python.

Installation

`bash $ pip install sunny `

Usage

Create your Solr connection (actually a pool of connections) and then pass query parameters using simple dictionaries. The raw Solr result is returned as a Python dictionary.

`python >>> import sunny >>> solr = sunny.Solr('http://localhost:8080/solr') >>> solr.query({'q': 'office', ... 'facet': 'on', ... 'facet.field': ['network', 'runtime']}) {u'responseHeader': {u'status': 0, u'QTime': ... `

Parameters

Solr parameters are passed as dictionaries where every value may be either a string or a list of strings.

wt=json is passed with every request no matter what, because JSON is easy to convert to Python objects.

Example:

`python >>> import sunny >>> solr = sunny.Solr('http://localhost:8080/solr') >>> solr.query({'q': 'office', ... 'facet': 'on', ... 'facet.field': ['network', 'runtime']}) {u'responseHeader': {u'status': 0, u'QTime': ... `

The above is equivalent to this query string: ?wt=json&q=office&facet=on&facet.field=network&facet.field=runtime

If the orderedmultidict package is installed, you may use omdict instances instead of dictionaries.

License

BSD

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

sunny-0.0.4.zip (5.8 kB view details)

Uploaded Source

File details

Details for the file sunny-0.0.4.zip.

File metadata

  • Download URL: sunny-0.0.4.zip
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sunny-0.0.4.zip
Algorithm Hash digest
SHA256 43bb995a1eee61544a7473cd7d48bda426f748b9b3a6e08e0365efc173a53da3
MD5 18b9dd74fe8477dcb095b024725c1f7e
BLAKE2b-256 f10f05957a2dc547ff154a4a0096959e0bb71ad4ce90f59709967cafaffcd865

See more details on using hashes here.

Supported by

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