Skip to content

Commit

Permalink
! Weight strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Feb 7, 2013
1 parent 031cb67 commit 6a5f6c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/lib/picky/backends/backend.rb
Expand Up @@ -291,10 +291,11 @@ def add id, str_or_sym, weight_strategy, similarity_strategy, where
ids = @inverted[str_or_sym] ||= []
ids.send where, id
end

# Weights.
#
@weights[str_or_sym] = weight_strategy.weight_for ids.size
@weights[str_or_sym] = weight_strategy.respond_to?(:[]) && weight_strategy[str_or_sym] ||
weight_strategy.weight_for(ids.size)

# Similarity.
#
Expand Down

0 comments on commit 6a5f6c3

Please sign in to comment.