Permalink
Browse files

implemented new aggregate function on ZINTERSTORE:

  • Loading branch information...
1 parent 516e840 commit 2a007325c17338c18a3479d3a9e3007d6da3bbc1 @amilkr amilkr committed Dec 22, 2011
Showing with 1 addition and 4 deletions.
  1. +1 −4 src/edis_db.erl
View
@@ -1876,7 +1876,7 @@ weighted_intersection(Aggregate, [{ZSet, Weight} | Rest], AccWeight, AccZSet) ->
Aggregate, Rest, 1.0,
zsets:intersection(
fun(Score, AccScore) ->
- lists:Aggregate([Score * Weight, AccScore * AccWeight])
+ edis_util:Aggregate(edis_util:multiply(Score,Weight),edis_util:multiply(AccScore,AccWeight))
end, ZSet, AccZSet)).
weighted_union(_Aggregate, [{ZSet, Weight}]) ->
@@ -1890,13 +1890,10 @@ weighted_union(Aggregate, [{ZSet, Weight} | Rest], AccWeight, AccZSet) ->
Aggregate, Rest, 1.0,
zsets:union(
fun(undefined, AccScore) ->
-%% AccScore * AccWeight;
edis_util:multiply(AccScore,AccWeight);
(Score, undefined) ->
-%% Score * Weight;
edis_util:multiply(Score,Weight);
(Score, AccScore) ->
-%% lists:Aggregate([Score * Weight, AccScore * AccWeight])
edis_util:Aggregate(edis_util:multiply(Score,Weight),edis_util:multiply(AccScore,AccWeight))
end, ZSet, AccZSet)).

0 comments on commit 2a00732

Please sign in to comment.