[ https://issues.apache.org/jira/browse/SOLR-11709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Munendra S N updated SOLR-11709: -------------------------------- Description: AFAICT, the simple string syntax of JSON Facet Modules "statistic facets" (ex: {{foo:"min(fieldA)"}} ) means there is no way to request a statistic with a domain change applied -- stats are always computed relative to it's immediate parent (ie: the baseset matching the {{q}} for a top level stat, or the constrained set if a stat is a subfacet of something else) This means that things like the simple "fq exclusion" in StatsComponent have no straight forward equivalent in JSON faceting. The work around appears to be to use a {{type:"query", q:"\*:\*, domain:...}} parent and specify the stats you are interested in as sub-facets... {code} $ curl 'http://localhost:8983/solr/techproducts/query' -d 'q=*:*&omitHeader=true&fq={!tag=boo}id:hoss&stats=true&stats.field={!max=true ex=boo}popularity&rows=0&json.facet={ bar: { type:"query", q:"*:*", domain:{excludeTags:boo}, facet: { foo:"max(popularity)" } } }' { "response":{"numFound":0,"start":0,"docs":[] }, "facets":{ "count":0, "bar":{ "count":32, "foo":10}}, "stats":{ "stats_fields":{ "popularity":{ "max":10.0}}}} {code} was: AFAICT, the simple string syntax of JSON Facet Modules "statistic facets" (ex: {{foo:"min(fieldA)"}} ) means there is no way to request a statistic with a domain change applied -- stats are always computed relative to it's immediate parent (ie: the baseset matching the {{q}} for a top level stat, or the constrained set if a stat is a subfacet of something else) This means that things like the simple "fq exclusion" in StatsComponent have no straight forward equivalent in JSON faceting. The work around appears to be to use a {{type:"query", q:"*:*, domain:...}} parent and specify the stats you are interested in as sub-facets... {code} $ curl 'http://localhost:8983/solr/techproducts/query' -d 'q=*:*&omitHeader=true&fq={!tag=boo}id:hoss&stats=true&stats.field={!max=true ex=boo}popularity&rows=0&json.facet={ bar: { type:"query", q:"*:*", domain:{excludeTags:boo}, facet: { foo:"max(popularity)" } } }' { "response":{"numFound":0,"start":0,"docs":[] }, "facets":{ "count":0, "bar":{ "count":32, "foo":10}}, "stats":{ "stats_fields":{ "popularity":{ "max":10.0}}}} {code} > JSON "Stats" Facets should support directly specifying a domain change (for > filters/blockjoin/etc...) > ----------------------------------------------------------------------------------------------------- > > Key: SOLR-11709 > URL: https://issues.apache.org/jira/browse/SOLR-11709 > Project: Solr > Issue Type: Sub-task > Components: Facet Module > Reporter: Chris M. Hostetter > Priority: Major > > AFAICT, the simple string syntax of JSON Facet Modules "statistic facets" > (ex: {{foo:"min(fieldA)"}} ) means there is no way to request a statistic > with a domain change applied -- stats are always computed relative to it's > immediate parent (ie: the baseset matching the {{q}} for a top level stat, or > the constrained set if a stat is a subfacet of something else) > This means that things like the simple "fq exclusion" in StatsComponent have > no straight forward equivalent in JSON faceting. > The work around appears to be to use a {{type:"query", q:"\*:\*, domain:...}} > parent and specify the stats you are interested in as sub-facets... > {code} > $ curl 'http://localhost:8983/solr/techproducts/query' -d > 'q=*:*&omitHeader=true&fq={!tag=boo}id:hoss&stats=true&stats.field={!max=true > ex=boo}popularity&rows=0&json.facet={ > bar: { type:"query", q:"*:*", domain:{excludeTags:boo}, facet: { > foo:"max(popularity)" } } }' > { > "response":{"numFound":0,"start":0,"docs":[] > }, > "facets":{ > "count":0, > "bar":{ > "count":32, > "foo":10}}, > "stats":{ > "stats_fields":{ > "popularity":{ > "max":10.0}}}} > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org