Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Assimilate aliases if provided in to the terms used to create the ind…
Browse files Browse the repository at this point in the history
…exes
  • Loading branch information
rixth committed May 10, 2011
1 parent 0936a3b commit 168aecd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/soulmate/loader.rb
Expand Up @@ -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
Expand Down

0 comments on commit 168aecd

Please sign in to comment.