lib/picky/query/indexes.rb in picky-3.6.7 vs lib/picky/query/indexes.rb in picky-3.6.8
- old
+ new
@@ -52,11 +52,11 @@
@ignored_categories.uniq!
end
# Returns a number of prepared (sorted, reduced etc.) allocations for the given tokens.
#
- def prepared_allocations_for tokens, weights = {}
+ def prepared_allocations_for tokens, weights = {}, amount = nil
allocations = allocations_for tokens
# Remove double allocations.
#
allocations.uniq
@@ -70,10 +70,10 @@
#
allocations.sort!
# Reduce the amount of allocations.
#
- # allocations.reduce_to some_amount
+ allocations.reduce_to amount if amount
# Remove categories from allocations.
#
allocations.remove ignored_categories if ignored_categories
\ No newline at end of file