liqd/adhocracy — pull request #614 by nidico (2013-11-05 14:18:31+00:00)
Title: Do not display other instance's userbadges in facet list (fixes #612)

WARNING: Update solr user index to enjoy that fix.

To make sure that only userbadges corresponding to the current instance
or global userbadges are shown in the userbadges facet of an instance's
user list, we need to store the list of user facets individually per
instance.

One part is the indexer, which calls add_data_to_index to the Facet
class (and doesn't construct a Facet instance).

The other part is the facetted querying which is done from within Facet
instances.

To achieve the latter, we now define a list of tuples of facets and
kwargs - the kwargs are added to the facet object and can be used later.
In the current case, the pager's instance is passed to the facet and can
be used by the UserBadgeFacet.solr_field property.

This increases the solr index quite a bit, as global facets are stored
redundantly for all instances. And it also increases indexing time.

Note that a similar workaround has been introduced in
adf7b0fd01cd346d61da69fa8b80d8739952f3ed, which allows separate user
activity scores for each instance. This however applies to a sorting
method and not to a facet.