>From the ref guide:

"Field names should consist of alphanumeric or underscore characters
only and not start with a digit."

While field naming isn't strictly enforced, having field names like
week_-1 is also not guaranteed to be supported. You should change your
field name.

I raised SOLR-11819 for one place I see in the ref guide where a
hyphen is used, if you see any others please add the location to the
JIRA (SOLR-11819).

Best,
Erick

On Thu, Jan 4, 2018 at 7:02 AM, RAUNAK AGRAWAL <agrawal.rau...@gmail.com> wrote:
> Hi Guys,
>
> I am facing issue where I am trying to follow the JSON facet API. I have
> data in my collection and field names are like "week_0", "week_-1" which
> means current week and previous week respectively.
>
> When I am querying for week_0 summation using the following query I am able
> to get the result.
>
> http://localhost:8983/solr/collection1/query?q=*:*&json.facet={week_0_sum:'sum(week_0)'}&rows=0
>
>
> But when I am trying to do the same for any field "week_-*", it is break.
>
> For example when I am trying:
> http://localhost:8983/solr/collection1/query?q=*:*&json.facet={week_-91_sum:%27sum(week_-91)%27}&rows=0
>
>
> I am getting the exception as* "msg": "undefined field: \"week_\"''*
>
>
> That means solr is stripping field name after hyphen (-). Is there
> workaround to fix this. I tried adding escape character (\) but it is of no
> help.
>
> With escape:
> http://localhost:8983/solr/collection1/query?q=*:*&json.facet={week_-91_sum:%27sum(week_\-91)%27}&rows=0
>
>
> Please help me regarding this.
>
> Thanks

Reply via email to