lib/picky/query/allocations.rb in picky-4.22.0 vs lib/picky/query/allocations.rb in picky-4.23.0

- old
+ new

@@ -111,13 +111,13 @@ # Note: Each allocation caches its count, but not its ids (thrown away). # The ids are cached in this class. # # Note: It's possible that no ids are returned by an allocation, but a count. (In case of an offset) # - def process! amount, offset = 0, terminate_early = nil + def process! amount, offset = 0, terminate_early = nil, sorting = nil each do |allocation| - calculated_ids = allocation.process! amount, offset + calculated_ids = allocation.process! amount, offset, sorting if calculated_ids.empty? offset = offset - allocation.count unless offset.zero? else amount = amount - calculated_ids.size # we need less results from the following allocation offset = 0 # we have already passed the offset @@ -135,13 +135,13 @@ # included if it contains no ids (even in case they have been # eliminated by the unique constraint in this method). # # Note: Slower than #process! especially with large offsets. # - def process_unique! amount, offset = 0, terminate_early = nil + def process_unique! amount, offset = 0, terminate_early = nil, sorting = nil unique_ids = [] each do |allocation| - calculated_ids = allocation.process_with_illegals! amount, 0, unique_ids + calculated_ids = allocation.process_with_illegals! amount, 0, unique_ids, sorting projected_offset = offset - allocation.count unique_ids += calculated_ids # uniq this? <- No, slower than just leaving duplicates. if projected_offset <= 0 allocation.ids.slice!(0, offset) end \ No newline at end of file