[ https://issues.apache.org/jira/browse/SOLR-6354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14091545#comment-14091545 ]
Hoss Man commented on SOLR-6354: -------------------------------- Proposed implementation... * SimpleStats should check the local params of each {{stats.field}} for a "type" param ** type is already treated special in local param parsing as as way to specify the parser type for the body of the string, ie: {{\{!foo\}...}} is just an alias for {{\{!type=foo\}...}} * if "type" param doesn't exist, or is the empty string, treat the param value as a regular field name and get it's value source (just like is done today) * if "type" does exist, do normal QParserPlugin lookup to parse the param value ** if the resulting Query is {{instanceof FunctionQuery}}, cast it and pull out it's ValueSource ** else: wrap the Query in a QueryValueSource * add a new subclass of NumericStatsValues that can be constructed directly with a ValueSource > Support stats over functions > ---------------------------- > > Key: SOLR-6354 > URL: https://issues.apache.org/jira/browse/SOLR-6354 > Project: Solr > Issue Type: Sub-task > Reporter: Hoss Man > > The majority of the logic in StatsValuesFactory for dealing with stats over > fields just uses the ValueSource API. There's very little reason we can't > generalize this to support computing aggregate stats over any arbitrary > function (or the scores from an arbitrary query). > Example... > {noformat} > stats.field={!func key=mean_rating > mean=true}prod(user_rating,pow(editor_rating,2)) > {noformat} > ...would mean that we can compute a conceptual "rating" for each doc by > multiplying the user_rating field by the square of the editor_rating field, > and then we'd compute the mean of that "rating" across all docs in the set > and return it as "mean_rating" -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org