Use a hash to store the values of a particular facet, like subject.
facets:subject -> <id>:<value>
Perform intersection across sets (for your search), and when it comes
to sorting your results, use SORT <result set> BY facets:subject .
> I thought on different approaches but for now all of them include doing lots
> of calls to redis and I have the feeling there might be a better way to do
> that.
The method I describe requires 2-3 calls:
1. intersect your sets
2. sort by your sorting mechanism and return all your results
OR
1. intersect your sets
2. sort by your sorting mechanism and store the results
3. make a call to fetch your "page" of results
> The approach I thought is the naive one: going through the results of the
> search and count (this won't show values with 0 number of results).
This should work, assuming you have the same idea of "faceted search"
as wikipedia.
- Josiah