Rebuilding Index
I have this code to rebuild my index
Book.where(is_public: true).order(id: :desc).find_each do |book|
recommender = Books_recommender.new
if @books.try(:bookstats).present?
recommender.add_to_matrix!(:readability, book.bookstats.readability, book.id)
else
recommender.add_to_matrix!(:readability, "50", book.id)
end
if book.downloadcount.present?
recommender.add_to_matrix!(:popularity, book.downloadcount, book.id)
end
book.tags.each do |tag|
recommender.add_to_matrix!(:tags, tag, book.id)
end
end
but I feel like this isn't the most efficient method, there are only 70,000 books I am using the LUA method and it has taken over 12 hours so far and it's still not done, and even if it is the most efficent method... I feel like rebuilding the index should be something in the core gem. Like how in sunspot / solr I have a variety of options for reindexing: https://github.com/sunspot/sunspot#reindexing-objects
Sorry for the late response. If you take off the bangs (e.g. add_to_matrix) and then run process! at the end, that would likely be more efficient. I think that process! method is equivalent to the support you're looking, for, right?