Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

! Weight strategy

  • Loading branch information...
commit 6a5f6c379c31442baf2ccafff5ca0299db16d7dc 1 parent 031cb67
@floere authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 server/lib/picky/backends/backend.rb
View
5 server/lib/picky/backends/backend.rb
@@ -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.
#
Please sign in to comment.
Something went wrong with that request. Please try again.