-
Notifications
You must be signed in to change notification settings - Fork 0
karanjeets/solrpy
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Solr API for Python =================== ``solrpy`` is a Python client for Solr_, an enterprise search server built on top of Lucene_. ``solrpy`` allows you to add documents to a Solr instance, and then to perform queries and gather search results from Solr using Python. Overview -------- Here's the basic gist:: import solr # create a connection to a solr server s = solr.SolrConnection('http://example.org:8083/solr') # add a document to the index doc = dict( id=1, title='Lucene in Action', author=['Erik Hatcher', 'Otis Gospodnetić'], ) s.add(doc, commit=True) # do a search response = s.query('title:lucene') for hit in response.results: print hit['title'] More powerful queries --------------------- Optional parameters for query, faceting, highlighting and more like this can be passed in as Python parameters to the query method. You just need to convert the dot notation (e.g. facet.field) to underscore notation (e.g. facet_field) so that they can be used as parameter names. For example, let's say you wanted to get faceting information in your search result:: response = s.query( 'title:lucene', facet='true', facet_field='subject') and if the parameter takes multiple values you just pass them in as a list:: response = s.query( 'title:lucene', facet='true', facet_field=['subject', 'publisher']) Community --------- Feel free to join our `discussion list`_ if you have ideas or suggestions. Also, please add examples to the wiki_ if you have the time and interest. .. _Solr: http://lucene.apache.org/solr/ .. _Lucene: http://lucene.apache.org/java/docs/ .. _discussion list: http://groups.google.com/group/solrpy .. _wiki: http://code.google.com/p/solrpy/w/list
About
Automatically exported from code.google.com/p/solrpy
Resources
Stars
Watchers
Forks
Packages 0
No packages published