2015-06-23 30 views
3

在Ruby中使用Algolia on Rails的,我可以很容易地指数模型:如何限制发送给Algolia的记录?

class Service < ActiveRecord::Base 
    include AlgoliaSearch 

    algoliasearch per_environment: true do 
    attributesToIndex ['name', 'canonical_url'] 
    attributes ['name', 'canonical_url] 
    add_attribute :type do 
     "Service" 
    end 
    end 
end 

是否有某种方式来限制哪些Service我要送?

例如:Only index Services where name != nil

回答