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 Mohamed Sirajudeen Mayitti Ahamed Pillai <mo...@footlocker.com> on 2020/07/13 16:44:30 UTC
Re: [EXTERNAL] Re: JSON Facet with local parameter
Thanks Chris,
It works like a charm.
http://server:8983/solr/collection/select?arrivalRange=121YEARS&json.facet={%22NEW%20ARRIVALS%22:{%22start%22:NOW/DAY-${arrivalRange},%20%22sort%22:%22index%22,%22type%22:%22range%22,%22field%22:%22pdp_activation_date_dt%22,%22gap%22:%22%2B${arrivalRange}%22,%22mincount%22:1,%22limit%22:-1,%22end%22:%22NOW/DAY%22}}&q=*:*&rows=0
"facets": {
"count": 14751,
"NEW ARRIVALS": {
"buckets": [
{
"val": "1899-07-13T00:00:00Z",
"count": 14750
}
]
}
}
On 7/13/20, 11:12 AM, "Chris Hostetter" <ho...@fucit.org> wrote:
The JSON based query APIs (including JSON Faceting) use (and unfortunately
subtly different) '${NAME}' syntax for dereferencing variables in the
"body" of a JSON data structure...
https://urldefense.com/v3/__https://lucene.apache.org/solr/guide/8_5/json-request-api.html*parameter-substitution-macro-expansion__;Iw!!COEUMkxN4gA!f1pqjDYAzcrrmKryMhBnkRR_tzBHbc0z9Q_uQTrqY7WBwWyFhxuKuZsnQpdOF6g8Fgv1jIFYwAzU9VQh6ADVIX-B$
...but note that you may need to put "quotes" around the variable
de-reference in order to make it a valid JSON string.
: Date: Mon, 13 Jul 2020 04:03:50 +0000
: From: Mohamed Sirajudeen Mayitti Ahamed Pillai
: <mo...@footlocker.com>
: Reply-To: solr-user@lucene.apache.org
: To: "solr-user@lucene.apache.org" <so...@lucene.apache.org>
: Subject: JSON Facet with local parameter
:
: Is it possible to refer local parameter for Range JSON Facet’s star/end/gap inputs ?
:
:
: I am trying something like below, but it is now working.
: https://urldefense.com/v3/__http://server:8983/solr/kfl/select?arrivalRange=NOW*DAY-10DAYS&json.facet=*7B*22NEW__;LyUl!!COEUMkxN4gA!f1pqjDYAzcrrmKryMhBnkRR_tzBHbc0z9Q_uQTrqY7WBwWyFhxuKuZsnQpdOF6g8Fgv1jIFYwAzU9VQh6J9KdRNL$ ARRIVALS":{"start":$arrivalRange, "sort":"index","type":"range","field":"pdp_activation_date_dt","gap":"+10DAYS","mincount":1,"limit":-1,"end":"NOW/DAY"}}&q=*:*&rows=0
:
: Getting below error,
:
: "error": {"metadata": ["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg": "Can't parse value $arrivalRange for field: pdp_activation_date_dt","code": 400}
:
:
: How to instruct Solr JSON Facet to reference another parameter that is added to the search request ?
:
:
:
:
:
-Hoss
https://urldefense.com/v3/__http://www.lucidworks.com/__;!!COEUMkxN4gA!f1pqjDYAzcrrmKryMhBnkRR_tzBHbc0z9Q_uQTrqY7WBwWyFhxuKuZsnQpdOF6g8Fgv1jIFYwAzU9VQh6I9KiXHR$