You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ct...@apache.org on 2017/10/19 20:42:32 UTC
lucene-solr:master: SOLR-11319: bring python with json docs up to
date. This closes #243
Repository: lucene-solr
Updated Branches:
refs/heads/master ae72dbd63 -> b7a53012e
SOLR-11319: bring python with json docs up to date. This closes #243
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b7a53012
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b7a53012
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b7a53012
Branch: refs/heads/master
Commit: b7a53012ed6ab095fb386d69c552ad2278b48664
Parents: ae72dbd
Author: Cassandra Targett <ct...@apache.org>
Authored: Thu Oct 19 15:41:38 2017 -0500
Committer: Cassandra Targett <ct...@apache.org>
Committed: Thu Oct 19 15:41:38 2017 -0500
----------------------------------------------------------------------
solr/solr-ref-guide/src/using-python.adoc | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b7a53012/solr/solr-ref-guide/src/using-python.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/using-python.adoc b/solr/solr-ref-guide/src/using-python.adoc
index 2c51486..732cd22 100644
--- a/solr/solr-ref-guide/src/using-python.adoc
+++ b/solr/solr-ref-guide/src/using-python.adoc
@@ -51,21 +51,16 @@ for document in response['response']['docs']:
== Python with JSON
-JSON is a more robust response format, but you will need to add a Python package in order to use it. At a command line, install the simplejson package like this:
+JSON is a more robust response format, and Python has support for it in its standard library since version 2.6.
-[source,bash]
-----
-sudo easy_install simplejson
-----
-
-Once that is done, making a query is nearly the same as before. However, notice that the wt query parameter is now json (which is also the default if not wt parameter is specified), and the response is now digested by `simplejson.load()`.
+Making a query is nearly the same as before. However, notice that the `wt` query parameter is now `json` (which is also the default if no `wt` parameter is specified), and the response is now digested by `json.load()`.
[source,python]
----
from urllib2 import *
-import simplejson
+import json
connection = urlopen('http://localhost:8983/solr/collection_name/select?q=cheese&wt=json')
-response = simplejson.load(connection)
+response = json.load(connection)
print response['response']['numFound'], "documents found."
# Print the name of each document.