lib/picky/bundle_indexing.rb in picky-3.4.2 vs lib/picky/bundle_indexing.rb in picky-3.4.3
- old
+ new
@@ -101,17 +101,28 @@
# derived indexes (like weights, similarity)
# and later dumping the optimized index.
#
# TODO Move this out to the category?
#
+ # Note: The clean way to do this would be to
+ # self.inverted.values.each &:uniq!
+ #
+ # Note 2:
+ # initialize_inverted_index_for token
+ # id = id.send(format)
+ # next if last_id == id
+ # self.inverted[token] << id
+ # last_id = id
+ #
def retrieve
format = key_format || :to_i
empty_inverted
+ id, last_id = nil, nil
prepared.retrieve do |id, token|
initialize_inverted_index_for token
self.inverted[token] << id.send(format)
- self.inverted[token].uniq!
end
+ self.inverted.values.each &:uniq!
end
# Generate a partial index from the given exact inverted index.
#
def generate_partial_from exact_inverted_index
\ No newline at end of file