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 Niko Weh <ni...@gmail.com> on 2016/01/08 00:06:56 UTC

Facetting on EnumFields using JSON API (Bug?)

Hi everyone,


I've posted in #solr and #solr-dev about this and was redirected here.

I'm having trouble with the JSON Facet API. Unsure whether it is a bug
or a usage error, but I couldn't find anything on google or the
documentation about this.

When facetting on an EnumField, i'm getting an error when using the JSON
API (but not the legacy API). For example, with a datetime field
"insertdate" and an EnumField state,

  ..&facet=on&rows=0&facet.field=state&facet.field=insertdate'

works fine.

Using the JSON API:

  json.facet={
    states: {field: state}, dates: {field: insertdate}
  }

throws an error:

  "error":{
    "msg":"Expected numeric field type
:state{type=auState,properties=indexed,stored,docValues}",
    "code":400}

It works fine though when i drop the "states: {...}" facet.

Example Setup and full error messages:
https://gist.github.com/xou/33fd7aab7afe3cebb28b

This is with current trunk solr, but i've seen the same behaviour in
5.4.0 and,  IIRC, 5.3.

I did hack together a quick patch[1], in case this is a bug, which makes
the query work and yields the same results for my test setup with ~20k
entries as the legacy facet api (although i'm pretty new to solr, so
that patch might not achieve this in the right way). And maybe it's
usage error (in which case though, the error message could probably need
a bit improving ;))

Cheers!

Niko



[1]
http://bildungsresistenz.de/tmp.h/0001-Added-support-for-facetting-on-enum-types.patch