ravendb/ravendb — pull request #490 by mweber26 (2012-08-16 04:56:14+00:00)
Title: Add support for virtually limitless terms for facets

Instead of issuing a query per facet term and searching through all of the facet terms for the index regardless whether they are in the baseQuery or not, this issues the baseQuery with a custom Lucene Collector. Doing this allows direct access to the terms (and counts) associated with that query.

Add support for limiting the number of returned FacetValues with a MaxResults field Facet document, and returning all terms that match the query as well.

Adds supprort for a FacetValue sort mode added that allows you to decide what "MaxResults" facet values to return (term ASC, term DESC, number of hits ASC, number of hits DESC).