I suggest doing this in two queries. In the first query, retrieve the unique ids of the top 50 documents. In the second query, just query for those ids (e.g., q=ids:(2 13 55 62 81)), and add the facet parameters on that query.
-Michael -----Original Message----- From: Aaron Gibbons [mailto:agibb...@synergydatasystems.com] Sent: Friday, July 11, 2014 1:46 PM To: solr-user@lucene.apache.org Subject: Group only top 50 results not All results. I'm trying to figure out how I can query solr for the top X results THEN group and count only those top 50 by their owner. I can run a query to get the top 50 results that I want. solr/select?q=(current_position_title%3a(TEST))&rows=50 I've tried Faceting but I get all results faceted not just the top 50: solr/select?q=(current_position_title%3a(TEST))&start=0&rows=50&facet=true&facet.field=recruiterkeyid&facet.limit=-1&facet.mincount=1&facet.sort=true I've tried Grouping and get all results again grouped not just the top 50. solr/select?q=(current_position_title%3a(TEST))&rows=50&group=true&group.field=recruiterkeyid&group.limit=1&group.format=grouped&version=2.2 I could also run one search to get the top X record Id's then run a second Grouped query on those but I was hoping there was a less expensive way run the search. So what I need to get back are the distinct recruiterkeyid's from the top X query and the count of how many there are only in the top X results. I'll ultimately want to query the results for each of individual recruiterkeyid as well. I'm using SolrNet to build the query. Thank you for your help, Aaron