lib/picky/query/indexes.rb in picky-4.6.0 vs lib/picky/query/indexes.rb in picky-4.6.1

- old
+ new

@@ -11,12 +11,10 @@ # # What it does is take the three given (API-) indexes and # # bundle them in an index bundle. # class Indexes - # TODO Only needed for . - # delegate :size, :first, :to => :@indexes attr_reader :indexes, @@ -30,11 +28,11 @@ def initialize *indexes IndexesCheck.check_backends indexes @indexes = indexes - @mapper = QualifierCategoryMapper.new indexes # TODO Move out? + @mapper = QualifierCategoryMapper.new indexes # TODO Move into search? end # Ignore the categories with these qualifiers. # # Example: @@ -66,25 +64,25 @@ # Returns a number of prepared (sorted, reduced etc.) allocations for the given tokens. # def prepared_allocations_for tokens, weights = {}, amount = nil allocations = allocations_for tokens - # Removed: Remove potential double allocations. - # - # Note: allocations are unique by definition. - # - # allocations.uniq! unless tokens.uniq? - # Score the allocations using weights as bias. # + # Note: Before we can sort them we need to score them. + # allocations.calculate_score weights # Sort the allocations. # (allocations are sorted according to score, highest to lowest) # + # Before we can chop off unimportant allocations, we need to sort them. + # allocations.sort! # Reduce the amount of allocations. + # + # Before we remove categories, we should reduce the amount of allocations. # allocations.reduce_to amount if amount # Remove categories from allocations. # \ No newline at end of file