Doug Turnbull created SOLR-9395:
-----------------------------------
Summary: 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]