[ 
https://issues.apache.org/jira/browse/SOLR-6354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hoss Man updated SOLR-6354:
---------------------------
    Attachment: SOLR-6354.patch


First start at a patch along the lines of the original idea i outlined (now 
that SOLR-6507 has cleaned up the duplicate/broken localparams code).

In this patch, you can see the logic for figuring out if/when we're dealing 
with field faceting vs query/function faceting.  In the test changes, you can 
see it being smart about requests to facet over a function that really just 
normalizes away to being a single field


The next steps from here are labeled with nocommits -- start propogating the 
StatsField instance directly to the various classes that deal with 
StatsValuesFactory so it can see if/when we need a schema based StatsValue 
instance, and when it should return a (new) StatsValue class that deals 
directly with a ValueSource

----

bq. do you think some of this work would make it easier for us to do stats on 
scores? Scores mean something in my application and I want to use them in the 
Stats component.

in the same sense that you can use \{!frange\} to filter on the scores of an 
arbitrary query, we should ultimately be able to compute stats on the scores of 
an arbitrary query -- but done in a second pass, regardless of wether or not 
hte specified query is the same as the "main" query.   

ie, something like this should work....

{noformat}
          q = foo bar^34 baz
      stats = true
stats.field = {!query key=score_stats v=$q}
{noformat}

...just as well as something like this...

{noformat}
          q = foo bar^3.4 +baz
      stats = true
stats.field = {!lucene key=some_other_query_score_stats}yak^1.2 +zazz
{noformat}

...but the first won't be doing anything special to compute the stats "on the 
fly" as documents are collected.


> 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
>         Attachments: SOLR-6354.patch, TstStatsComponent.java
>
>
> 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.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to