Permalink
Browse files

Use bulk import methods to index gists

  • Loading branch information...
1 parent 8620861 commit 7f89e318c113bbf770c7b8efc2b4fc0709513c3d @rwdaigle committed Oct 20, 2012
Showing with 4 additions and 5 deletions.
  1. +3 −3 app/models/gist.rb
  2. +1 −2 app/models/user.rb
View
@@ -78,10 +78,10 @@ def search(user, q)
end
end
- def reindex
+ def reindex(gists = scoped)
log({ns: self, fn: __method__}) do
- find_each { |gist| gist.update_index }
- tire.index.refresh
+ tire.index.import gists
+ # tire.index.refresh # @nz said this wasn't needed
end
end
View
@@ -30,9 +30,8 @@ def authenticate(auth)
def refresh_index(user_id)
user = User.find(user_id)
log({ns: self, fn: __method__}, user) do
- user.gists.each { |gist| gist.update_index }
+ Gist.reindex(user.gists)
end
- Gist.tire.index.refresh
end
def fetched!(user_id)

0 comments on commit 7f89e31

Please sign in to comment.