Permalink
Browse files

Assimilate aliases if provided in to the terms used to create the ind…

…exes
  • Loading branch information...
1 parent 0936a3b commit 168aecdeccb32dc910431e527330931599e1a810 @rixth rixth committed May 10, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/soulmate/loader.rb
View
@@ -29,9 +29,11 @@ def load(items)
# 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|
- 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
+ ([term] + (item["aliases"] || [])).each do |term|
+ prefixes_for_phrase(term).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
end
items_loaded += 1
end

0 comments on commit 168aecd

Please sign in to comment.