Rails - Indexing a Sunspot Conditional Model

Is there a way to determine at runtime if a model should be indexed or not? Sort of:

class Article < ActiveRecord::Base searchable :if => :indexable? do ... end private def indexable? ... end end 
+4
source share
2 answers

Here's a good article on conditional indexing: http://mikepackdev.com/blog_posts/19-conditional-indexing-with-sunspot

That is exactly the API that you offer in your question.

+2
source

Source: https://habr.com/ru/post/1341659/


All Articles