Field Collapsing has a limitation. Currently it will not allow you to get different number of results from a each group.
You can plug a custom AnalyticQuery, which can do exactly what you want with after seeing a matching document. https://cwiki.apache.org/confluence/display/solr/AnalyticsQuery+API On 18 August 2014 04:32, Erick Erickson <erickerick...@gmail.com> wrote: > Aurélien is correct, for the exact behavior you're looking > for you'd need to run w queries. > > But you might be able to make do with field collapsing. > You'd probably have to copyField from title to > title_grouping which would be un-analyzed (string type > or KeywordTokenizer), then group on _that_ field. > You'd get back the top N matches grouped by title and > your app could display that info however it made sense. > > "Grouping" sometimes goes by "field collapsing" FWIW. > Erick > > On Sun, Aug 17, 2014 at 2:16 PM, talt <mikaelsaltz...@gmail.com> wrote: > > I have a field in my SOLR index, let's call it book_title. > > > > A query returns 15 rows with book_title:"The Kite Runner", 13 rows with > > book_title:"The Stranger", and 8 rows with book_title:"The Ruby Way". > > > > Is there a way to return only the first row of "The Kite Runner" and "The > > Stranger", but all of the "The Ruby Way" rows from the previous query > > result? This would result in 10 rows altogether. Is this possible at all, > > using a single query? > > > > > > > > -- > > View this message in context: > http://lucene.472066.n3.nabble.com/Selectively-setting-the-number-of-returned-SOLR-rows-per-field-based-on-field-value-tp4153441.html > > Sent from the Solr - User mailing list archive at Nabble.com. > -- Thanks & Regards Umesh Prasad Search l...@flipkart.com in.linkedin.com/pub/umesh-prasad/6/5bb/580/