how add facet to pysolr query

1.5k views Asked by At

I am new to solr,am using pysolr, I have a very basic question.

How can I add a facet to the pysolr query?
my solr query is: ip:8983/solr....q=...&facet=on&facet.field=xyz

its working in browser as I wish.

I want to know how can I implement it in my following code,

what the syntax to add facet in pysolr(facet=on&facet.field=xyz )

**

solrquery = "(.................. )" 
 solr.search([solrquery],)

**

1

There are 1 answers

0
Jisson On BEST ANSWER

Use

solrquery = "(.................. )" 
solr.search([solrquery],facet = 'on' ,** {'facet.field' : ['fieldname']})