when we use curl or urlopen with facet to execute queries, we get a nested dictionary with 3 elements 1. responseHeader 2. response 3. facet_counts
I want to show the facet_counts while using Pysolr search. It just shows the 'response' value of the query output. I'm trying the following code, please help.
import pysolr
conn = pysolr.Solr('http://localhost:8983/solr/')
result = conn.search('enron', **{
'fl' : 'body',
'facet' : 'on'
})
for r in result:
print r
When you're iterating over the
result
variable, you're iterating over pysolr's own Results object (and not directly over the JSON structure as shown by Solr).Any facets will be present under the
facets
property of this results object.The example above outputs: