You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jeffery Yuan <yu...@gmail.com> on 2016/10/05 22:15:50 UTC

SolrJ doesn't work with Json facet api

It seems that Solr returns different format when use Json facet api compared
with the old syntax
Thus solrj facet related api will not work when use Json facet api
rsp.getFacetField("myFeild") is null

The Json API is easier to use, its response is cleaner. 
But it would be even better if it works with SolrJ.

http://localhost:8983/solr/events/select?q=*:* &json.facet={myFeild:{type
:terms, field :myFeild}}&rows=0&wt=json
"facets": {
  "count": 4023950,
  "myFeild": {
    "numBuckets": 540,
    "buckets": [{
      "val": "unknown",
      "count": 401738
    }, {
      "val": "comedy central",
      "count": 163782
    }]
    ]
  }
}

http://localhost:8983/solr/vue_session_events/select?q=*&facet=true&facet.field=myFeild&wt=json&rows=0&wt=json
"facet_counts": {
  "facet_queries": {},
  "facet_fields": {
    "myFeild": ["key1", count]
  },
  "facet_dates": {},
  "facet_ranges": {},
  "facet_intervals": {},
  "facet_heatmaps": {}
}



--
View this message in context: http://lucene.472066.n3.nabble.com/SolrJ-doesn-t-work-with-Json-facet-api-tp4299867.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: SolrJ doesn't work with Json facet api

Posted by Sandeep Khanzode <sa...@yahoo.com.INVALID>.
For me, these variants have worked ...

solrQuery.add("json.facet", "...");

solrQuery.setParam("json.facet", "...");
 
You get ...
QueryResponse.getResponse().get("facets");

SRK 

    On Thursday, January 5, 2017 1:19 PM, Jeffery Yuan <yu...@gmail.com> wrote:
 

 Thanks for your response.
We definitely use solrQuery.set("json.facet", "the json query here");

Btw we are using Solr 5.2.1.





--
View this message in context: http://lucene.472066.n3.nabble.com/SolrJ-doesn-t-work-with-Json-facet-api-tp4299867p4312459.html
Sent from the Solr - User mailing list archive at Nabble.com.


   

Re: SolrJ doesn't work with Json facet api

Posted by Jeffery Yuan <yu...@gmail.com>.
Thanks for your response.
We definitely use solrQuery.set("json.facet", "the json query here");

Btw we are using Solr 5.2.1.





--
View this message in context: http://lucene.472066.n3.nabble.com/SolrJ-doesn-t-work-with-Json-facet-api-tp4299867p4312459.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: SolrJ doesn't work with Json facet api

Posted by shamik <sh...@gmail.com>.
You can try something like :

query.add("json.facet", your_json_facet_query); 



--
View this message in context: http://lucene.472066.n3.nabble.com/SolrJ-doesn-t-work-with-Json-facet-api-tp4299867p4299888.html
Sent from the Solr - User mailing list archive at Nabble.com.