Have you looked at the JSON facet capabilities? It might work for you.... Best, Erick
On Thu, Jul 6, 2017 at 9:09 AM, John Blythe <j...@curvolabs.com> wrote: > hi all. > > i'm attempting to find similar purchases for a user. the volume of purchase > helps dictate the price point that they can expect. as such, i'm attempting > to determine the sum of the quantity field across all purchases per user. > > i've got something like this as of yet: > > facet=on& >> stats=true& >> stats.field={!tag=stats1}quantity& >> stats.facet=userId& >> facet.pivot={!stats=stats1.sum}userId& > > > i can see in the stats' faceting the "sum" property has what i'm looking > for. perhaps purchase #1 was a quantity of 2, purchase #2 was a quantity of > 5, so the min is 2, the max is 5, and the sum is 7. that's exactly what i'm > wanting. > > the facet.pivot, however, only shows me a count of how many records were a > part of that summation, so a count of 2 given my example above. > > as you can see, i'd attempted to access the 'sum' property of the stats by > giving it a tag and trying to access with dot notation. no luck there. > > i can use an algorithm to loop over the results of course but would love to > have the data more readily accessible when solr returns it AND even better > be able to filter query / facet query on it so that i can weed out results > that don't meet my criterion (e.g. fq=quantitySum:[* to $userQuantity]) > > thanks for any insights!