One can not apply range query syntax over function. {!frange} query parser can handle that.
On Sat, Dec 8, 2018 at 2:45 PM Venu <thotavenumadhav...@gmail.com> wrote: > I am using solr6.6. I am trying to use parameter Dereferencing for json > facets. > > There can be multiple prices for all the documents(assume sp, price1, > price2, price3, price4 are the prices for all the documents). > > Based on the query, I have to fetch the minimum value among the combination > of those prices and create facets among them. > > It can be done with frange. But is there a way that this can be done with > json facets? > > Below sample query works: > > localhost:8983/solrcloud/myconf/select?q=apple& > json.facet={ > 'prices':{ > 'type': 'query', > 'q': "${FIELD}:[0 TO 20]" > } > } > &FIELD=sp > > But when I try to use something like this: > > localhost:8983/solrcloud/myconf/select?q=apple& > json.facet={ > 'prices':{ > 'type': 'query', > 'q': "${FIELD}:[0 TO 20]" > } > }&FIELD=min(price1, price2, price3, sp) > > My other query can be like as below: > > localhost:8983/solrcloud/myconf/select?q=apple& > json.facet={ > 'prices':{ > 'type': 'query', > 'q': "${FIELD}:[0 TO 20]" > } > }&FIELD=min(price1, price3, sp) > > or > > localhost:8983/solrcloud/myconf/select?q=apple& > json.facet={ > 'prices':{ > 'type': 'query', > 'q': "${FIELD}:[0 TO 20]" > } > }&FIELD=min(price1, price2) > > I can use any kind combination like (price1, price2) or (price4, sp).. etc > > I am getting below error: > > <lst name="error"> > <lst name="metadata"> > <str name="error-class">org.apache.solr.common.SolrException</str> > <str name="root-error-class">org.apache.solr.parser.ParseException</str> > </lst> > <str name="msg"> > org.apache.solr.search.SyntaxError: Cannot parse 'min(price1, price2, > price3):[0 TO 20]': Encountered " ":" ": "" at line 1, column 12. Was > expecting one of: <EOF> <AND> ... <OR> ... <NOT> ... "+" ... "-" ... > <BAREOPER> ... "(" ... "*" ... "^" ... <QUOTED> ... <TERM> ... <PREFIXTERM> > ... <WILDTERM> ... <REGEXPTERM> ... "[" ... "{" ... <LPARAMS> ... "filter(" > ... <NUMBER> ... > </str> > <int name="code">400</int> > </lst> > Is it possible to do function query while forming query? > > > > -- > Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html > -- Sincerely yours Mikhail Khludnev