lib/picky/backends/backend.rb in picky-4.17.1 vs lib/picky/backends/backend.rb in picky-4.18.0

- old
+ new

@@ -46,17 +46,17 @@ # def create_realtime bundle json bundle.index_path(:realtime) end - # Returns the total score of the combinations. - # - # Default implementation. Override to speed up. - # - def weight combinations - combinations.score - end + # # Returns the total score of the combinations. + # # + # # Default implementation. Override to speed up. + # # + # def score combinations + # combinations.score + # end # Returns the result ids for the allocation. # # Sorts the ids by size and & through them in the following order (sizes): # 0. [100_000, 400, 30, 2] @@ -70,20 +70,14 @@ # offset hints. # We cannot use the information to speed up the algorithm, # unfortunately. # def ids combinations, _, _ - # Get the ids for each combination. + # Get the ids for each combination and pass to the optimized C algorithm. # - id_arrays = combinations.inject([]) do |total, combination| - total << combination.ids - end - - # Call the optimized C algorithm. - # # Note: It orders the passed arrays by size. # - Performant::Array.memory_efficient_intersect id_arrays + Performant::Array.memory_efficient_intersect combinations.map { |combination| combination.ids } end # # def to_s \ No newline at end of file