[
https://issues.apache.org/jira/browse/SOLR-9395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15414317#comment-15414317
]
Hoss Man commented on SOLR-9395:
--------------------------------
bq. So, correct me if I'm wrong, but it appears this feature is essentially
just about changing what the JSON Facets API calls the "domain" of the stats?
That's a good point -- with classic distributed facets this sort of thing is
possible by hanging stats off of pivot facets, but no one has ever implemented
hanging stats off of facet.queries, so you can do something like this...
{noformat}
http://localhost:8983/solr/techproducts/select?q=*:*&stats=true&stats.field={!key=mean_price%20tag=s1%20mean=true}price&rows=0&facet=true&facet.pivot={!stats=s1}inStock
{noformat}
but you can't currently do something like these...
{noformat}
http://localhost:8983/solr/techproducts/select?q=*:*&stats=true&stats.field={!key=mean_price%20tag=s1%20mean=true}price&rows=0&facet=true&facet.query={!stats=s1}inStock:true
http://localhost:8983/solr/techproducts/select?q=*:*&stats=true&stats.field={!key=mean_price%20tag=s1%20mean=true}price&rows=0&facet=true&facet.query={!stats=s1}price:{0%20TO%20*]
{noformat}
...adding that would be fairly trivial, the biggest complexity is that it would
require a response format change for facet.query to support the nested stats
response.
> Add ceil/floor bounding to stats calculations
> ---------------------------------------------
>
> Key: SOLR-9395
> URL: https://issues.apache.org/jira/browse/SOLR-9395
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Affects Versions: master (7.0)
> Reporter: Doug Turnbull
> Fix For: master (7.0)
>
>
> In the pull request to be attached we add optional ceil and floor parameters
> to a field being computed via the stats component. This bounds the stats
> calculations to ceil to floor inclusive.
> For example, let's say your searching over all the employees.
> stats=true&stats.field=employee_age
> But you want to focus on employees aged 18-60 for whatever reason. You can
> reissue this query as
> stats=true&stats.field={!floor=18 ceil=60}employee_age
> This limits the resulting stats calculations to 18-60 inclusive. This
> functionality also works on date fields (see test in PR).
> Now one question might be, why not do this with a filter query? In many cases
> you don't necessarily want to filter these documents from the main search
> results. You just want to eliminate outliers from a specific stats
> calculation. For example, you search your employee database for "clerks." You
> still want to see all the clerks, even little 16 year old Timmy. But for this
> particular calculation you just want to focus on folks of traditional working
> age for whatever reason.
> Some notes
> - floor/ceil are only supported as local params.
> - works for date and numeric values
> - date math works!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]