Redis › RedisSearch (Full Text Search)

How would you design a RedisSearch based product search feature that supports faceted filtering, such as showing available categories and their counts alongside search results?

Advanced

Answer

You would use RedisSearch's aggregation capabilities through the FT.AGGREGATE command, grouping matched results by category and counting occurrences within each group, letting you display both the actual search results and a summary of available filter categories with counts, similar to what you commonly see on major e-commerce search pages.
FT.AGGREGATE product_idx '@name:laptop' GROUPBY 1 @category REDUCE COUNT 0 AS count
Real-world example An e-commerce search results page shows customers not just matching products but also a sidebar listing each available category along with how many matching products exist in each one, powered by a RedisSearch aggregation query.

Common follow-ups: What other aggregation operations does FT.AGGREGATE support besides counting?;How does aggregation performance compare to a simple search query on the same dataset?