Hi Erick/Yonik,

Thank you guys. I am going to rename the fields.

On Thu, Jan 4, 2018 at 10:04 PM, Yonik Seeley <ysee...@gmail.com> wrote:

> The JSON Facet API uses the function query parser for something like
> sum(week_-91) so you'll probably have problems with any function that
> uses these fields as well.
> As Erick says, you're better off renaming the fields.  There is a
> workaround for wonky field names via the "field" function:
> sum(field(week_-91))
>
> -Yonik
>
>
> On Thu, Jan 4, 2018 at 10: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