If you mean counting categories etc - then at the moment no, but the next version will include aggregations which can do that and way more. ETA is 1-2 weeks
Great. The way it will work is that you’ll have to issue two separate requests - one for the actual results, and one for the facets.
The fact query will look like this:
FT.AGGREGATE myIndex “hello world”
GROUPBY 1 @category
REDUCE count 0 AS categry_size
SORTBY 1 @category_size MAX 20
This will yield the top 20 categories for the query “hello world”
You can actually play with it right now, but it’s not documented yet, so I’d wait a bit more.
What about if we have an array of categories? I have a similar requirement but I couldn’t write the query. How can I use groupby and reduce if I have an array of categories?
31 Ocak 2018 Çarşamba 12:28:59 UTC+3 tarihinde Dvir Volk yazdı:
We want to make facet search not by category but by variations like alibaba.com. We have a lot of variations and variation values in our filters.
I send you our data model by attach. We want to make facet search by that variation serials. These serials are id of the variations and we will get the real names of them from cache. I tried a query something like this:
FT.AGGREGATE product_search mollit APPLY split(@variationSerials) as serial GROUPBY 1 @serial REDUCE COUNT 0
I can’t get any results with this query, it runs forever. If I don’t use GROUPBY part I can see the variation serials seperately. How can I group and reduce to get count of each variation serials?
17 Ağustos 2018 Cuma 16:34:37 UTC+3 tarihinde Itamar Haber yazdı:
Just like in any other database, you can group by whatever you want and count whatever you want.
But for each grouping and counting you have a cartesian product. If you group by age, gender and occupation you end up with a shit ton of groups.
If you want to group and count by age, then group and count by gender, then group and count by occupation -that’s 3 separate queries.
What this use case essentially requires is several distinct pipelines that can be executed in parallel. It’s usually not the strict nature of a “single” query (the age, for example- in this query, has no relation to gender) but the user still would like them to be summed. When specifying multiple GROUPBYs currently, it all affects a single pipeline. I am wondering if we cannot add a MULTIGROUPBY which functions just like GROUPBY, but executes pipelines in parallel (in theory).
Mark Nunberg | Senior Software Engineer Redis Labs - home of Redis