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 "Michael Aleythe, Sternwald" <mi...@sternwald.com> on 2016/09/09 12:08:55 UTC
solr json facets return format
Hi everybody,
i'm currently working on using the json request api for solr and hit a problem using facets. I'm using solr 5.5.2 and solrJ 5.5.2
When querying solr by url-parameters like so:
http://.../select?wt=json&facet.range=MEDIA_TS&f.MEDIA_TS.facet.range.end=2028-02-01T0:00:00.000Z&f.MEDIA_TS.facet.range.gap=%2B1YEAR&f.MEDIA_TS.facet.range.start=1993-01-01T0:00:00.000Z&facet=true
the returned json contains an element called "facet_counts" which is the top element for all faceting information.
: "facet_counts":
: {
: : "facet_queries":
: : {
: : },
: : "facet_fields":
: : {
: : },
: : "facet_dates":
: : {
: : },
: : "facet_ranges":
: : {
: : : "MEDIA_TS":
: : : {
: : : : "counts":
: : : : [
: : : : : "1993-01-01T00:00:00Z",
: : : : : 0,
: : : : : "1994-01-01T00:00:00Z",
: : : : : 1634,
: : : : : "1995-01-01T00:00:00Z",
: : : : : 6656,
: : : : : "1996-01-01T00:00:00Z",
: : : : : 30016,
: : : : : "1997-01-01T00:00:00Z",
: : : : : 76819,
: : : : : "1998-01-01T00:00:00Z",
: : : : : 152099,
The same query using the json request api like so:
{"facet":{"MEDIA_TS":{"field":"MEDIA_TS","gap":"+1YEAR","start":"1993-01-01T00:00:00Z","end":"2028-01-01T00:00:00Z","type":"range"}}}
Returns an element "facets" which is the top element for all faceting information:
: "facets":
: {
: : "count":5815481,
: : "MEDIA_TS":
: : {
: : : "buckets":
: : : [
: : : : {
: : : : : "val":"1993-01-01T00:00:00Z",
: : : : : "count":0
: : : : },
: : : : {
: : : : : "val":"1994-01-01T00:00:00Z",
: : : : : "count":1634
: : : : },
: : : : {
: : : : : "val":"1995-01-01T00:00:00Z",
: : : : : "count":6656
: : : : },
This inconsistency breaks the respone parser of solrJ. Am i doing something wrong?
Best Regards
Michael Aleythe
Java Entwickler | STERNWALD SYSTEMS GMBH