You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2006/07/22 04:07:08 UTC
[Solr Wiki] Update of "SolPython" by YonikSeeley
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by YonikSeeley:
http://wiki.apache.org/solr/SolPython
New page:
== Using Solr's Python output ==
Solr has an optional Python response format that extends it's JSON output in the following ways:
* true and false changed to True and False
* Python unicode strings used where needed
* ASCII output (with unicode escapes) for less error-prone interoperability
* newlines escaped
* null changed to None
Here is a simple example of how one may query Solr using the Python response format:
{{{
from urllib2 import *
conn = urlopen('http://localhost:8983/solr/select?q=iPod&wt=python')
rsp = eval( conn.read() )
print "number of matches=", rsp['response']['numFound']
#print out the name field for each returned document
for doc in rsp['response']['docs']:
print 'name field =', doc['name']
}}}