Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0, 6.0
    • None
    • None

    Description

      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...

      stats.field={!func key=mean_rating mean=true}prod(user_rating,pow(editor_rating,2))
      

      ...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"

      Attachments

        1. SOLR-6354.patch
          55 kB
          Chris M. Hostetter
        2. SOLR-6354.patch
          49 kB
          Chris M. Hostetter
        3. SOLR-6354.patch
          15 kB
          Chris M. Hostetter
        4. TstStatsComponent.java
          19 kB
          Crawdaddy

        Issue Links

          Activity

            People

              hossman Chris M. Hostetter
              hossman Chris M. Hostetter
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: