This is more of a PSA than something that I want to be changed.
The facet configuration forms for normal Search API indexes have a setting for the "Minimum facet count." It allows you to limit the display of facets to those that have a count >= the number you set.
It turns out that the implementing module's hook_facetapi_info_alter() controls whether or not this config setting is displayed. For Sarnia indexes, this setting is turned off. My assumption is that it had to be turned off because Sarnia can't make an assumption about whether or not the setting will work with the Solr config. I don't know. I'm not familiar with how it all works. That's just my guess.
The minimum facet count setting may work if you turn it on though. It worked with the two test servers that I tried it out on. If you're interested in trying to enable it on your server, apply the attached patch and clear the site cache.
If there is some reason why Sarnia can't enable this setting for all indexes, then we may still be able to turn it on conditionally. If it's possible to determine whether or not the server can handle it by querying its configuration, then Sarnia could probably be patched to turn on the setting only for certain indexes. Otherwise, hopefully this will help anyone brave enough to hack their module to turn the setting on.
| Comment | File | Size | Author |
|---|---|---|---|
| sarnia-min-facet-count.patch | 501 bytes | dcam |
Comments
Comment #1
dcam commentedComment #2
jmdeleon commentedTried it... seems to work.
Comment #3
dcam commentedI've done research on the minimum facet count this afternoon. From what I can tell, there's no reason why this can't be enabled by default. I suppose if you had a highly-customized configuration containing an override of the default Solr FacetComponent class, then it might cause some sort of problem. I doubt it though. I would expect that if that custom class didn't accept the facet.mincount parameter then it would just be ignored.
Anyway, the Solr Search Component docs say that the FacetComponent is turned on by default for all search handlers. The FacetComponent includes the mincount setting by default as of Solr 1.2. Thus, I don't know why we wouldn't want the setting to be configurable in the FacetAPI pages. Nor do I have any guess as to why it was turned off for Sarnia facets in the first place.
If it were up to me, I would commit the patch to enable it for everyone. I don't think it will do any harm.
Comment #5
jmdeleon commentedComment #6
jmdeleon commentedComment #7
jmdeleon commentedNow in beta5.