lib/soulmate/loader.rb in soulmate-0.0.3 vs lib/soulmate/loader.rb in soulmate-0.0.4

- old
+ new

@@ -27,10 +27,11 @@ if id and term # store the raw data in a separate key to reduce memory usage Soulmate.redis.hset(database, id, JSON.dump(item)) - prefixes_for_phrase(term).each do |p| + phrase = ([term] + (item["aliases"] || [])).join(' ') + prefixes_for_phrase(phrase).uniq.each do |p| Soulmate.redis.sadd(base, p) # remember this prefix in a master set Soulmate.redis.zadd("#{base}:#{p}", score, id) # store the id of this term in the index end items_loaded += 1 end \ No newline at end of file