It's not possible to do such thing in one request with faceting only. The problem is that you need a fixed filter on every item when the facet algorithm is iterating over it; you can't look into future elements to find out which ones the top 10 will be.
So either you stick with two queries (which may be fast enough anyway when you only have ca. 100 items in your collection), or you fetch the data for the top 10 items and do the calculation on your own. -Michael Am 17.02.2017 um 11:35 schrieb Zheng Lin Edwin Yeo: > I'm looking at JSON facet for both of type:terms and type:range. > > For example, I may have 100 Items in my collections, and each item can have > many transactions. But I'm only interested to look at the top 10 items > which has the highest transaction rate (ie the highest count) > > I'm doing a calculation of the total amount and average amount. However, I > will only want the total amount and average amount to be calculated based > on the top 10 items which has the highest transaction rate, and not all the > 100 items. > > For now, I need the additional query to get the top 10 items first, before > I run the JSON Facet to get the total amount and average amount for that 10 > items. > > Regards, > Edwin > > > On 17 February 2017 at 18:02, alessandro.benedetti <a.benede...@sease.io> > wrote: > >> I think we are missing something here ... >> You want to fetch the top 10 results for your query, and allow the user to >> navigate only those 10 results through facets ? >> >> Which facets are you interested in ? >> Field facets ? >> Whatever facet you want, calculating it in your client, on 10 results >> shouldn't be that problematic. >> Are we missing something ? Why you would need an additional query ? >> >> Cheers >> >> >> >> ----- >> --------------- >> Alessandro Benedetti >> Search Consultant, R&D Software Engineer, Director >> Sease Ltd. - www.sease.io >> -- >> View this message in context: http://lucene.472066.n3. >> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html >> Sent from the Solr - User mailing list archive at Nabble.com. >>