Skip to content

buildfax/SolrClient

 
 

Repository files navigation

Build Status Documentation Status

SolrClient

SolrClient 0.1

SolrClient is a simple python library for Solr; built in python3 with support for latest features of Solr 5. Development is heavily focused on indexing as well as parsing various query responses and returning them in native python data structures. Several helper classes will be built to automate querying and management of Solr clusters.

Requirements

Features

  • Flexible and simple query mechanism
  • Response Object to easily extract data from Solr Response
  • Cursor Mark support
  • Indexing (raw JSON, JSON Files, gzipped JSON)
  • Specify multiple hosts/IPs for SolrCloud for redundancy
  • Basic Managed Schema field management
  • IndexManager for storing indexing documents off-line and batch indexing them

Getting Started

Installation:

pip install SolrClient

Basic usage:

>>> from SolrClient import SolrClient
>>> solr = SolrClient('http://localhost:8983/solr')
>>> res = solr.query('SolrClient_unittest',{
            'q':'product_name:Lorem',
            'facet':True,
            'facet.field':'facet_test',
    })
>>> res.get_results_count()
4
>>> res.get_facets()
{'facet_test': {'ipsum': 0, 'sit': 0, 'dolor': 2, 'amet,': 1, 'Lorem': 1}}
>>> res.get_facet_keys_as_list('facet_test')
['ipsum', 'sit', 'dolor', 'amet,', 'Lorem']
>>> res.docs
[{'product_name_exact': 'orci. Morbi ipsum 
..... all the docs .... 
 'consectetur Mauris dolor Lorem adipiscing'}]

See, easy.... you just need to know the Solr query syntax.

Roadmap

  • Better test coverage
  • HTTPS Support
  • urllib support
  • Collection Alias Management
  • Collection Re-indexing with cursor mark
  • More Schema API Action Calls
  • Collections API Support

Contributing

I've realized that that there isn't really a well maintained Solr Python library I liked so I put this together. Contributions (code, tests, documentation) are definitely welcome; if you have a question about development please open up an issue on github page. If you have a pull request, please make sure to add tests and that all of them pass before submitting. See tests README for testing resources.

Documentation: http://solrclient.readthedocs.org/en/latest/

About

SolrClient is a simple python library for Solr; built in python3 with support for latest features of Solr.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%