lib/picky/bundle_realtime.rb in picky-4.12.8 vs lib/picky/bundle_realtime.rb in picky-4.12.10

- old
+ new

@@ -1,9 +1,14 @@ module Picky class Bundle - + + # TODO Push methods back into the backend, so that we + # can apply more efficient methods tailored for + # each specific backends. + # + # Removes the given id from the indexes. # def remove id # Is it anywhere? # @@ -26,19 +31,24 @@ # (One idea is to add an array of ids and remove from that) # @similarity.delete self.similarity_strategy.encode(str_or_sym) else @weights[str_or_sym] = self.weight_strategy.weight_for ids.size + # @weights[str_or_sym] = self.weight_strategy.respond_to?(:[]) && + # self.weight_strategy[str_or_sym] || + # self.weight_strategy.weight_for(ids.size) end end @realtime.delete id end # Returns a reference to the array where the id has been added. # def add id, str_or_sym, where = :unshift + # Use a generalized strategy. + # str_or_syms = @realtime[id] ||= [] # Inverted. # ids = if str_or_syms.include? str_or_sym @@ -47,10 +57,9 @@ ids.send where, id else # Update the realtime index. # str_or_syms << str_or_sym - ids = @inverted[str_or_sym] ||= [] ids.send where, id end # Weights.