Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…exes
  • Loading branch information...
commit 168aecdeccb32dc910431e527330931599e1a810 1 parent 0936a3b
Thomas Rix rixth authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/soulmate/loader.rb
8 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
Please sign in to comment.
Something went wrong with that request. Please try again.