: You can also do it on a more straightforward way: preprocess docs to derive : a number_or_colors field, eg. via UpdateProcessor and filter for this field : as usual.
i think this is definitely the more natural way for users to address this use case, and requires no custom code... https://lucene.apache.org/solr/4_1_0/solr-core/org/apache/solr/update/processor/CountFieldValuesUpdateProcessorFactory.html -Hoss