...
Algorithm:
1- Find all possible values for f1 which are (A,B) , for f2 which are (I,J) and for f3 which are (1,2,3)
2- Find Cartesian Product of (A,B)X(I,J)X(1,2,3). (12 possible groups)
3- Eliminate the ones that surely result in 0 hits. (for ex, B J 2. since they have no doc. in common)
Tips & Tricks
- SFS instances are thread-safe. So, the same instance can be shared among many threads like IndexReader
- SFS should only be created when an IndexReader is opened/reopened. Creation with every search can be performance killer
- Iterating over the thousands of results(e.g, 1000 facets x 25 Hits per facet) can be too costly. The old trick can be used here too, "just show the hit counts, and make a new search when user clicks a category".
Memory Requirements
For each instance of SFS and search results:
MemUsage = (Document# in Index) / 8 * (Facet Count); // e.g, 1M docs & 1000 facets cost ~128MB (So, caching results of SFS searches may not be a good idea)
...