I would prefer extending the given CollapseComponent, because of performance-reasons. What you want to do sounds a bit like making things too complicate.
There are two options I would prefer: 1. get the schema-information for every field you want to query against and define, whether you want to facet before or after collapsing. As far as I have understood: For multiValued fields you want to facet before collapsing, because if you facet after collapsing, the returned counts are wrong. 2. As a developer, you know which of the queried fields is a multiValued one. Knowing this, you create a new param that contains on those fields, you always want to facet on BEFORE collapsing. I want to emphasize that I never had a look at the sourcecode of the patch. However, I really think that you do not need to reimplement so much things. You only need to implement the logic when to facet which field. That's everything. And as far as the component seems to implement both things: facet before *and* after collapsing, you can use the provided methods to make your logic work. Just some thoughts. :) Kind regards - Mitch -- View this message in context: http://lucene.472066.n3.nabble.com/Custom-SearchComponent-to-reset-facet-value-counts-after-collapse-tp770826p776896.html Sent from the Solr - User mailing list archive at Nabble.com.