Skip to content

Missing aggregation type "COUNT" of ZUNIONSTORE #1416

@ts-thomas

Description

@ts-thomas

I couldn't find a way how to properly stack up the count of union matches to the calculation.

This is what I theoretically need:

// a set of keys
keys = [ .... ];
// initial weights to 1
weights = [ 1, 1, 1, ....];

// store union with COUNT as the new score
redis.zUnionStore(dest, keys, { AGGREGATE: "COUNT" });

// push the destination to the keys
keys.push(dest);
// add some high value to the weights to prefer the
// ordering based on count over the sum of score
weights.push(999);

// calculate final results with the right ordering
redis.zUnionStore(dest, keys, { WEIGHTS: weights, AGGREGATE: "SUM" });

In SQL something simliar is ORDER BY count DESC, score DESC

Is there a chance to add such functionality to the library? Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions