#How to apply 2 solr search index on same object (Celebrity)
It's apparently impossible to index twice same object with sunspot solr and 2 searchable block.
##1st idea Create another model (Speaker) that inherits the searchable's model, and apply on Speaker's model another searchable block. This configuration doesn't work because Speaker's searchable block doesn't totally override Celebrity's model block, it's possible to add index on fields that don't be indexed yet but it's impossible to delete indexed fields
##2nd Idea Create a second model (Speaker) that uses the table's first model ( Celebrity ). We can add a searchable block on Speaker and create new indexes .
Now we need to force Solr to index Speaker data when Celebrity object is saved :
#celebrity model
after_save :index_speaker
def index_speaker
Sunspot.index! Speaker.find self.id
end
Need to be carefull with relations and validations and save data ... cause Speaker doesn't inherit from Celebrity and this can be a problem.