[
https://issues.apache.org/jira/browse/SOLR-9395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15412876#comment-15412876
]
David Smiley commented on SOLR-9395:
------------------------------------
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? FWIW
the JSON Facet API can do this already by hanging stats off of a facet query
see https://cwiki.apache.org/confluence/display/solr/Faceted+Search and search
for "Query Facet" which has an example of a range query then computing the
average of some other field -- though it could have been on the same field as
the range query of course.
> 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]