lib/picky/backends/redis.rb in picky-3.1.0 vs lib/picky/backends/redis.rb in picky-3.1.1

- old
+ new

@@ -10,21 +10,33 @@ def initialize options = {} @client = options[:client] || ::Redis.new(:db => (options[:db] || 15)) end + # Returns an object that responds to: + # [:token] # => [id, id, id, id, id] (an array of ids) + # def create_inverted bundle - Redis::ListHash.new client, "#{bundle.identifier}:inverted" + List.new client, "#{bundle.identifier}:inverted" end + # Returns an object that responds to: + # [:token] # => 1.23 (a weight) + # def create_weights bundle - Redis::FloatHash.new client, "#{bundle.identifier}:weights" + Float.new client, "#{bundle.identifier}:weights" end + # Returns an object that responds to: + # [:encoded] # => [:original, :original] (an array of original symbols this similarity encoded thing maps to) + # def create_similarity bundle - Redis::ListHash.new client, "#{bundle.identifier}:similarity" + List.new client, "#{bundle.identifier}:similarity" end + # Returns an object that responds to: + # [:key] # => value (a value for this config key) + # def create_configuration bundle - Redis::StringHash.new client, "#{bundle.identifier}:configuration" + String.new client, "#{bundle.identifier}:configuration" end # Returns the result ids for the allocation. # # Developers wanting to program fast intersection @@ -32,11 +44,9 @@ # backend implementations. # # Note: We use the amount and offset hints to speed Redis up. # def ids combinations, amount, offset - return [] if combinations.empty? - identifiers = combinations.inject([]) do |identifiers, combination| identifiers << "#{combination.identifier}" end result_id = generate_intermediate_result_id \ No newline at end of file